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/Tango.PPC.UI/Dialogs | |
| 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/Tango.PPC.UI/Dialogs')
3 files changed, 226 insertions, 0 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 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)); + } + } + } + } + } +} + |
