aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2023-05-22 18:54:00 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2023-05-22 18:54:00 +0300
commitb981d43669a2cdcd9f7971e897ded9f1422f5b31 (patch)
treeb42b4dcf7a74788d0ae5388c96311a9ecb9c8047 /Software/Visual_Studio/PPC
parent7b97669957c3de66ffbad0dba26db1396c679a48 (diff)
downloadTango-b981d43669a2cdcd9f7971e897ded9f1422f5b31.tar.gz
Tango-b981d43669a2cdcd9f7971e897ded9f1422f5b31.zip
FSE, update Job length for Eureka. GeneralInformation in PPC ( about) - added rows.
Related Work Items: #8423
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml56
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs86
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
3 files changed, 142 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml
index b4bc717cc..8ae0f4354 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml
@@ -111,7 +111,61 @@
</Paragraph>
</TableCell>
</TableRow>
-
+ <TableRow>
+ <TableCell>
+ <Paragraph>
+ <TextBlock>Up Time:</TextBlock>
+ </Paragraph>
+ </TableCell>
+
+ <TableCell>
+ <Paragraph>
+ <TextBlock Text="{Binding UpTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"></TextBlock>
+ </Paragraph>
+ </TableCell>
+ </TableRow>
+ <TableRow>
+ <TableCell>
+ <Paragraph>
+ <TextBlock>IP Address:</TextBlock>
+ </Paragraph>
+ </TableCell>
+
+ <TableCell>
+ <Paragraph>
+ <TextBlock Text="{Binding IPAddress,Mode=OneWay,FallbackValue=0}"></TextBlock>
+ </Paragraph>
+ </TableCell>
+ </TableRow>
+
+ <TableRow>
+ <TableCell>
+ <Paragraph>
+ <TextBlock>Total Dye Time:</TextBlock>
+ </Paragraph>
+ </TableCell>
+
+ <TableCell>
+ <Paragraph>
+ <TextBlock Text="{Binding TotalDyeTime,Mode=OneWay,FallbackValue=0}"></TextBlock>
+ </Paragraph>
+ </TableCell>
+ </TableRow>
+
+ <TableRow>
+ <TableCell>
+ <Paragraph>
+ <TextBlock>Total Dye Meters:</TextBlock>
+ </Paragraph>
+ </TableCell>
+
+ <TableCell>
+ <Paragraph>
+ <TextBlock Text="{Binding TotalDyeMeters,Mode=OneWay,FallbackValue=0}"></TextBlock>
+ </Paragraph>
+ </TableCell>
+ </TableRow>
+
</TableRowGroup>
</Table>
</FlowDocument>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs
index c680f4b90..7f810b2f3 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs
@@ -12,6 +12,18 @@ using Tango.PPC.Common.Connection;
using Tango.PPC.Common.Notifications;
using Tango.Settings;
using Tango.SharedUI;
+using Tango.PPC.Common.UWF;
+using Tango.Core.Commands;
+using Tango.PPC.Common.OS;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Management;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading.Tasks;
+using System.Timers;
+
namespace Tango.PPC.UI.Dialogs
{
@@ -48,11 +60,43 @@ namespace Tango.PPC.UI.Dialogs
get { return CurrentSite == null ? "" : CurrentSite.Name; }
}
+ private String _ipAddress;
+ public String IPAddress
+ {
+ get { return _ipAddress; }
+ set { _ipAddress = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _totalDyeTime;
+ public String TotalDyeTime
+ {
+ get { return _totalDyeTime; }
+ set { _totalDyeTime = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _totalDyeMeters;
+ public String TotalDyeMeters
+ {
+ get { return _totalDyeMeters; }
+ set { _totalDyeMeters = value; RaisePropertyChangedAuto(); }
+ }
+
+ private TimeSpan _upTime;
+ public TimeSpan UpTime
+ {
+ get { return _upTime; }
+ set { _upTime = value; RaisePropertyChangedAuto(); }
+ }
+
public GeneralInformationViewVM( IMachineProvider provider, IPPCApplicationManager appManager)
{
MachineProvider = provider;
ApplicationManager = appManager;
InitSite();
+
+ IPAddress = GetIpv4Address();
+ InitTotalDyeProp();
+ UpTime = DateTime.Now - ApplicationManager.StartUpDate;
}
public async void InitSite()
@@ -71,6 +115,48 @@ namespace Tango.PPC.UI.Dialogs
}
}
}
+
+ 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";
+ }
+ }
+
+ public async void InitTotalDyeProp()
+ {
+ try
+ {
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ var jobRuns = await db.JobRuns.Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).ToListAsync();
+
+ TotalDyeTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToStringUnlimitedHours();
+
+ int meters = (int)jobRuns.Select(x => x.EndPosition).Sum();
+ TotalDyeMeters = $"{meters.ToString("N0")} meters";
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error loading machine counters.");
+ TotalDyeTime = "error!";
+ TotalDyeMeters = "error!";
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
index d72e75011..efc5f8179 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
@@ -16,7 +16,7 @@
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
</requestedPrivileges>
</security>
</trustInfo>