diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-17 15:54:30 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-17 15:54:30 +0300 |
| commit | 11aff2c52535254745dd521322b2b7f46ae16123 (patch) | |
| tree | e122666e3f2203fb0f2f5f5024b20aa2fe77aade /Software/Visual_Studio/PPC | |
| parent | 67fbfd4810548b363ea2e3a1a0454408020df42f (diff) | |
| download | Tango-11aff2c52535254745dd521322b2b7f46ae16123.tar.gz Tango-11aff2c52535254745dd521322b2b7f46ae16123.zip | |
PPC. Added General Information dialog. Changes in System Technion for Eureka.
Diffstat (limited to 'Software/Visual_Studio/PPC')
8 files changed, 465 insertions, 7 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 452907366..e3f695514 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 @@ -15,6 +15,7 @@ using Tango.PPC.Common.OS; using Tango.Settings; using System.Data.Entity; using Tango.PPC.Common.UWF; +using Tango.BL.Entities; namespace Tango.PPC.Technician.ViewModels { @@ -74,6 +75,14 @@ namespace Tango.PPC.Technician.ViewModels set { _totalDyeMeters = value; RaisePropertyChangedAuto(); } } + public Site CurrentSite { get; set; } + + public String SiteName + { + get { return CurrentSite == null? "" : CurrentSite.Name; } + } + + public RelayCommand ResetDeviceCommand { get; set; } public RelayCommand RestartCommand { get; set; } @@ -181,6 +190,8 @@ namespace Tango.PPC.Technician.ViewModels _statsTimer.Interval = 2000; _statsTimer.Elapsed += _statsTimer_Elapsed; _statsTimer.Start(); + + InitSite(); } private void _statsTimer_Elapsed(object sender, ElapsedEventArgs e) @@ -299,5 +310,22 @@ namespace Tango.PPC.Technician.ViewModels TotalDyeMeters = "error!"; } } + + public async void InitSite() + { + if (CurrentSite == null) + { + var machine = MachineProvider.Machine; + if (machine != null && !String.IsNullOrEmpty(machine.SiteGuid)) + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var site = (await db.Sites.Where(x => x.Guid == machine.SiteGuid).ToListAsync()).FirstOrDefault(); + CurrentSite = site; + RaisePropertyChanged( nameof(SiteName)); + } + } + } + } } } 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 fc0f734ff..8ef29bb7e 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 @@ -110,7 +110,7 @@ </touch:TouchButton> </StackPanel> - <FlowDocumentScrollViewer VerticalScrollBarVisibility="Disabled"> + <FlowDocumentScrollViewer VerticalScrollBarVisibility="Disabled" Visibility="{Binding BuildProvider.IsEureka, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <FlowDocument> <Table CellSpacing="0" FontFamily="{StaticResource TangoFlexoFontFamily}"> <Table.Resources> @@ -174,7 +174,7 @@ </TableCell> </TableRow> - <TableRow> + <TableRow > <TableCell> <Paragraph> <TextBlock>FPGA 1:</TextBlock> @@ -320,6 +320,188 @@ </Table> </FlowDocument> </FlowDocumentScrollViewer> + <FlowDocumentScrollViewer VerticalScrollBarVisibility="Disabled" Visibility="{Binding BuildProvider.IsEureka, Converter={StaticResource BooleanToVisibilityConverter}}"> + <FlowDocument> + <Table CellSpacing="0" FontFamily="{StaticResource TangoFlexoFontFamily}"> + <Table.Resources> + <Style TargetType="{x:Type TableRowGroup}"> + <Setter Property="FontSize" Value="{StaticResource TangoDefaultFontSize}"/> + </Style> + + <Style TargetType="TableCell"> + <Setter Property="BorderThickness" Value="0 0 0 1"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoGrayBrush}"></Setter> + <Setter Property="Padding" Value="5"></Setter> + </Style> + </Table.Resources> + <Table.Columns> + <TableColumn Width="160" /> + <TableColumn /> + <TableColumn /> + </Table.Columns> + + <TableRowGroup> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Environment:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding Settings.DeploymentSlot,Converter={StaticResource EnumToDescriptionConverter},Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Application Version:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding ApplicationManager.VersionAndTag,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Site:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding SiteName,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Machine S/N:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.Machine.SerialNumber,Mode=OneWay,IsAsync=True,FallbackValue='0000'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Firmware Version:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.MachineOperator.DeviceInformation.Version,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>CPU:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock> + <Run Text="{Binding CPU,Mode=OneWay,StringFormat='0',FallbackValue=0}"></Run> + <Run>%</Run> + </TextBlock> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>RAM:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding RAM,Mode=OneWay,FallbackValue=0,Converter={StaticResource ByteArrayToFileSizeConverter},StringFormat='0'}"></TextBlock> + </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> + </FlowDocumentScrollViewer> </DockPanel> </touch:LightTouchScrollViewer> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml new file mode 100644 index 000000000..b4bc717cc --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml @@ -0,0 +1,122 @@ +<UserControl x:Class="Tango.PPC.UI.Dialogs.GeneralInformationView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.UI.Dialogs" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" Width="750" Height="700" d:DataContext="{d:DesignInstance Type=local:GeneralInformationViewVM, IsDesignTimeCreatable=False}"> + <Grid Margin="20"> + <DockPanel> + + <Grid DockPanel.Dock="Bottom" Margin="0 20 0 0"> + <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="180" Height="50" VerticalAlignment="Bottom">CLOSE</touch:TouchButton> + </Grid> + + <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center"> + <Image Source="../Images/logo.png" RenderOptions.BitmapScalingMode="Fant" Width="157" Height="51" Stretch="Uniform" HorizontalAlignment="Center" Margin="0 10 0 10"/> + <TextBlock VerticalAlignment="Center" Margin="0 30 0 0" FontSize="{StaticResource TangoHeaderFontSize}">General Information</TextBlock> + </StackPanel> + + <Grid Margin="0 30 0 0"> + <FlowDocumentScrollViewer VerticalScrollBarVisibility="Disabled" > + <FlowDocument> + <Table CellSpacing="0" FontFamily="{StaticResource TangoFlexoFontFamily}"> + <Table.Resources> + <Style TargetType="{x:Type TableRowGroup}"> + <Setter Property="FontSize" Value="{StaticResource TangoDefaultFontSize}"/> + </Style> + + <Style TargetType="TableCell"> + <Setter Property="BorderThickness" Value="0 0 0 1"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoGrayBrush}"></Setter> + <Setter Property="Padding" Value="5"></Setter> + </Style> + </Table.Resources> + <Table.Columns> + <TableColumn Width="160" /> + <TableColumn /> + <TableColumn /> + </Table.Columns> + + <TableRowGroup> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Environment:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding Settings.DeploymentSlot,Converter={StaticResource EnumToDescriptionConverter},Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Application Version:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding ApplicationManager.VersionAndTag,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Site:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding SiteName,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Machine S/N:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.Machine.SerialNumber,Mode=OneWay,IsAsync=True,FallbackValue='0000'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Firmware Version:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.MachineOperator.DeviceInformation.Version,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + </TableRowGroup> + </Table> + </FlowDocument> + </FlowDocumentScrollViewer> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml.cs new file mode 100644 index 000000000..3e01d9b93 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Dialogs +{ + /// <summary> + /// Interaction logic for GeneralInformationView.xaml + /// </summary> + public partial class GeneralInformationView : UserControl + { + public GeneralInformationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs new file mode 100644 index 000000000..c680f4b90 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs @@ -0,0 +1,76 @@ +using System; +using System.Data.Entity; +using System.Linq; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Core.DI; +using Tango.Integration.Operation; +using Tango.PMR.Diagnostics; +using Tango.PPC.Common; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class GeneralInformationViewVM : DialogViewVM + { + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + + [TangoInject] + public IPPCApplicationManager ApplicationManager { get; set; } + + private PPCSettings _settings; + /// <summary> + /// Gets the main PPC settings. + /// </summary> + public PPCSettings Settings + { + get + { + if (_settings == null) + { + _settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + } + + return _settings; + } + private set { _settings = value; } + } + + public Site CurrentSite { get; set; } + + public String SiteName + { + get { return CurrentSite == null ? "" : CurrentSite.Name; } + } + + public GeneralInformationViewVM( IMachineProvider provider, IPPCApplicationManager appManager) + { + MachineProvider = provider; + ApplicationManager = appManager; + InitSite(); + } + + public async void InitSite() + { + if (CurrentSite == null) + { + var machine = MachineProvider.Machine; + if (machine != null && !String.IsNullOrEmpty(machine.SiteGuid)) + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var site = (await db.Sites.Where(x => x.Guid == machine.SiteGuid).ToListAsync()).FirstOrDefault(); + CurrentSite = site; + RaisePropertyChanged(nameof(SiteName)); + } + } + } + } + } +} + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 12d0486bd..e02dba00e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -182,6 +182,10 @@ <Compile Include="Dialogs\CartridgeValidationView.xaml.cs"> <DependentUpon>CartridgeValidationView.xaml</DependentUpon> </Compile> + <Compile Include="Dialogs\GeneralInformationView.xaml.cs"> + <DependentUpon>GeneralInformationView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\GeneralInformationViewVM.cs" /> <Compile Include="Dialogs\InsufficientLiquidQuantityView.xaml.cs"> <DependentUpon>InsufficientLiquidQuantityView.xaml</DependentUpon> </Compile> @@ -350,6 +354,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Dialogs\GeneralInformationView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Dialogs\InsufficientLiquidQuantityView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 95eb22d7a..f40a89f42 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -293,6 +293,10 @@ namespace Tango.PPC.UI.ViewModels /// Gets or sets the stand by command. /// </summary> public RelayCommand StandByCommand { get; set; } + /// <summary> + /// Gets or sets the open general information dialog command. + /// </summary> + public RelayCommand OpenGeneralinformationCommand { get; set; } #endregion @@ -317,6 +321,7 @@ namespace Tango.PPC.UI.ViewModels PowerOffCommand = new RelayCommand(PowerOffMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); ResetCommand = new RelayCommand(ResetMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); StandByCommand = new RelayCommand(StandBy, () => MachineProvider.MachineOperator.CanPrint); + OpenGeneralinformationCommand = new RelayCommand(OpenGeneralinformationDlg); _date_timer = new DispatcherTimer(); _date_timer.Interval = TimeSpan.FromSeconds(1); @@ -527,6 +532,13 @@ namespace Tango.PPC.UI.ViewModels IsMenuOpened = false; } + private async void OpenGeneralinformationDlg() + { + GeneralInformationViewVM vm = new GeneralInformationViewVM(MachineProvider, ApplicationManager); + vm = await NotificationProvider.ShowDialog<GeneralInformationViewVM>(vm); + + } + #endregion #region Override Methods diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml index a72dc2d1d..84d1108f2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml @@ -47,11 +47,13 @@ <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> </Border.Effect>--> <!--</Border>--> - <StackPanel > - <DockPanel Background="{StaticResource TangoMenuPanelDarkBrush}"> - <Image Source="/Images/logo.png" Stretch="Uniform" HorizontalAlignment="Center" Margin="0 10 10 10" Width="157" Height="51"></Image> - </DockPanel> - </StackPanel> + <touch:TouchButton Padding="0 0" Command="{Binding OpenGeneralinformationCommand}" Style="{StaticResource TangoFlatButton}" Background="Transparent"> + <StackPanel > + <DockPanel Background="{StaticResource TangoMenuPanelDarkBrush}"> + <Image Source="/Images/logo.png" Stretch="Uniform" HorizontalAlignment="Center" Margin="0 10 10 10" Width="157" Height="51"></Image> + </DockPanel> + </StackPanel> + </touch:TouchButton> </Grid> </Border> <touch:TouchButton Command="{Binding MenuOrBackCommand}" Padding="8" Style="{StaticResource TangoFlatButton}" Width="164" Height="32" IsHitTestVisible="{Binding NavigationManager.IsNavigating,Converter={StaticResource BooleanInverseConverter}}" |
