aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-10-07 16:41:45 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-10-07 16:41:45 +0300
commiteae70d7ebcb1007b407bac2ba27da5a5fef337db (patch)
tree67febce63cc498102a86eb69263508c6c70f0b1f /Software/Visual_Studio/PPC/Modules
parente131de20ac8e179abc42a2dc173cf860d64a3bcd (diff)
parent583d3716e37a9be80c8bb248215f343ed4fcd2d1 (diff)
downloadTango-eae70d7ebcb1007b407bac2ba27da5a5fef337db.tar.gz
Tango-eae70d7ebcb1007b407bac2ba27da5a5fef337db.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs43
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml41
2 files changed, 71 insertions, 13 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
index e01003c0b..444c1d09e 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Management;
+using System.Net;
+using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
@@ -40,6 +42,20 @@ namespace Tango.PPC.Technician.ViewModels
set { _temperature = value; RaisePropertyChangedAuto(); }
}
+ private TimeSpan _upTime;
+ public TimeSpan UpTime
+ {
+ get { return _upTime; }
+ set { _upTime = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _ipAddress;
+ public String IPAddress
+ {
+ get { return _ipAddress; }
+ set { _ipAddress = value; RaisePropertyChangedAuto(); }
+ }
+
public RelayCommand ResetDeviceCommand { get; set; }
public RelayCommand RestartCommand { get; set; }
@@ -132,6 +148,12 @@ namespace Tango.PPC.Technician.ViewModels
_statsTimer.Start();
}
+ public override void OnApplicationReady()
+ {
+ base.OnApplicationReady();
+ IPAddress = GetIpv4Address();
+ }
+
private void _statsTimer_Elapsed(object sender, ElapsedEventArgs e)
{
if (IsVisible)
@@ -139,6 +161,7 @@ namespace Tango.PPC.Technician.ViewModels
CPU = GetAppCPU();
RAM = GetAppRam();
//Temperature = GetTemperature();
+ UpTime = DateTime.Now - ApplicationManager.StartUpDate;
}
}
@@ -201,5 +224,25 @@ namespace Tango.PPC.Technician.ViewModels
return 0;
}
}
+
+ public String GetIpv4Address()
+ {
+ try
+ {
+ var host = Dns.GetHostEntry(Dns.GetHostName());
+ foreach (var ip in host.AddressList)
+ {
+ if (ip.AddressFamily == AddressFamily.InterNetwork)
+ {
+ return ip.ToString();
+ }
+ }
+ return "N/A";
+ }
+ catch (Exception ex)
+ {
+ return "N/A";
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
index f6e6370c1..f2bfcdf7d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
@@ -49,19 +49,34 @@
</TextBlock>
</UniformGrid>
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" TextElement.FontSize="{StaticResource TangoTitleFontSize}">
- <touch:TouchButton Command="{Binding ResetDeviceCommand}" Height="60" Content="Reset Machine">
- <touch:TouchButton.Style>
- <Style TargetType="touch:TouchButton" BasedOn="{StaticResource {x:Type touch:TouchButton}}">
- <Setter Property="Background" Value="{StaticResource TangoErrorBrush}"></Setter>
- </Style>
- </touch:TouchButton.Style>
- </touch:TouchButton>
- <touch:TouchButton Command="{Binding RestartCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Restart Device</touch:TouchButton>
- <touch:TouchButton Command="{Binding ShutdownCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Shutdown Device</touch:TouchButton>
- <touch:TouchButton Command="{Binding FactoryResetCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Factory Reset</touch:TouchButton>
- <touch:TouchButton Command="{Binding ExitToExplorerCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Exit To Shell</touch:TouchButton>
- </StackPanel>
+ <DockPanel>
+
+ <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center">
+ <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold" FontSize="{StaticResource TangoHeaderFontSize}">
+ <Run>UP TIME:</Run>
+ <Run Text="{Binding UpTime,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"></Run>
+ </TextBlock>
+
+ <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontWeight="SemiBold" FontSize="{StaticResource TangoHeaderFontSize}">
+ <Run>IP ADDRESS:</Run>
+ <Run Text="{Binding IPAddress}"></Run>
+ </TextBlock>
+ </StackPanel>
+
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" TextElement.FontSize="{StaticResource TangoTitleFontSize}">
+ <touch:TouchButton Command="{Binding ResetDeviceCommand}" Height="60" Content="Reset Machine">
+ <touch:TouchButton.Style>
+ <Style TargetType="touch:TouchButton" BasedOn="{StaticResource {x:Type touch:TouchButton}}">
+ <Setter Property="Background" Value="{StaticResource TangoErrorBrush}"></Setter>
+ </Style>
+ </touch:TouchButton.Style>
+ </touch:TouchButton>
+ <touch:TouchButton Command="{Binding RestartCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Restart Device</touch:TouchButton>
+ <touch:TouchButton Command="{Binding ShutdownCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Shutdown Device</touch:TouchButton>
+ <touch:TouchButton Command="{Binding FactoryResetCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Factory Reset</touch:TouchButton>
+ <touch:TouchButton Command="{Binding ExitToExplorerCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Exit To Shell</touch:TouchButton>
+ </StackPanel>
+ </DockPanel>
</DockPanel>
</Grid>
</Grid>