diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-27 12:09:07 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-27 12:09:07 +0200 |
| commit | 312e8ccad554d6d0e7d21444e069731e770db978 (patch) | |
| tree | d20a3657dab87de400675f5f8aca77c0f124b2bd /Software/Visual_Studio/PPC | |
| parent | 4954a924b8a5b8fd7a213a444027e74b936359be (diff) | |
| download | Tango-312e8ccad554d6d0e7d21444e069731e770db978.tar.gz Tango-312e8ccad554d6d0e7d21444e069731e770db978.zip | |
Added DEVICE_ID, DEVICE_NAME & IS_DEVICE_REGISTERED fields to db.
Prevent multiple machine setup from different devices.
Moved notification to inner layout on PPC.
Improved PPC notification bar.
Added more machine status support from embedded.
FIxed issue with external bridge and emergency pressed.
Diffstat (limited to 'Software/Visual_Studio/PPC')
7 files changed, 163 insertions, 71 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index 94091b284..004c37096 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -132,6 +132,9 @@ namespace Tango.PPC.Common.MachineSetup MachineSetupRequest request = new MachineSetupRequest(); request.SerialNumber = serialNumber; + request.DeviceID = await _windows_manager.GetDeviceId(); + request.DeviceName = await _windows_manager.GetDeviceName(); + MachineSetupResponse setup_response = null; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs index d0c8567a1..2164a71c3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs @@ -168,5 +168,69 @@ namespace Tango.PPC.Common.OS { Process.Start("shutdown.exe", "-s -t 0"); } + + /// <summary> + /// Gets the machine unique identifier. + /// </summary> + /// <returns></returns> + public Task<string> GetDeviceId() + { + return Task.Factory.StartNew<String>(() => + { + try + { + ManagementObjectCollection mbsList = null; + ManagementObjectSearcher mbs = new ManagementObjectSearcher("Select * From Win32_processor"); + mbsList = mbs.Get(); + string id = ""; + foreach (ManagementObject mo in mbsList) + { + id = mo["ProcessorID"].ToString(); + } + + string max_address = ""; + + using (ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration")) + { + using (ManagementObjectCollection moc = mc.GetInstances()) + { + if (moc != null) + { + foreach (ManagementObject mo in moc) + { + if (string.IsNullOrEmpty(max_address)) // only return MAC Address from first card + { + if (mo["MacAddress"] != null) + { + max_address = mo["MacAddress"].ToString(); + } + } + mo.Dispose(); + } + } + } + } + + return id + "_" + max_address; + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not extract device id. Falling back to device name..."); + return GetDeviceName().Result; + } + }); + } + + /// <summary> + /// Gets the machine host name. + /// </summary> + /// <returns></returns> + public Task<string> GetDeviceName() + { + return Task.Factory.StartNew<String>(() => + { + return Environment.MachineName; + }); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IOperationSystemManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IOperationSystemManager.cs index f3ec398fc..3e24ffe72 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IOperationSystemManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IOperationSystemManager.cs @@ -45,6 +45,18 @@ namespace Tango.PPC.Common.OS Task ChangeTimeZone(TimeZoneInfo timeZone); /// <summary> + /// Gets the machine unique identifier. + /// </summary> + /// <returns></returns> + Task<String> GetDeviceId(); + + /// <summary> + /// Gets the machine host name. + /// </summary> + /// <returns></returns> + Task<String> GetDeviceName(); + + /// <summary> /// Restarts the system. /// </summary> /// <returns></returns> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs index 83bec6b07..821828a48 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs @@ -10,5 +10,7 @@ namespace Tango.PPC.Common.Web public class MachineSetupRequest : WebRequestMessage { public String SerialNumber { get; set; } + public String DeviceID { get; set; } + public String DeviceName { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index dce92c2dd..7284830a0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -13,6 +13,7 @@ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:commonControls="clr-namespace:Tango.PPC.Common.Controls;assembly=Tango.PPC.Common" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:components="clr-namespace:Tango.Touch.Components;assembly=Tango.Touch" xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:LayoutViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LayoutViewVM}"> @@ -20,6 +21,7 @@ <UserControl.Resources> <localConverters:ItemBaseConverter x:Key="NotificationItemConverter" /> <localConverters:AppBarItemConverter x:Key="AppBarItemConverter" /> + <localConverters:ItemBaseConverter x:Key="ItemBaseConverter" /> </UserControl.Resources> <Grid> @@ -228,55 +230,79 @@ </Border> </touch:TouchSideMenu.MenuContent> - <DockPanel> - <Border BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" DockPanel.Dock="Top"> - <DockPanel> - <Border BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoDividerBrush}"> - <touch:TouchHamburgerButton Width="100" Height="100" Padding="15" Command="{Binding MenuOrBackCommand}" EnableDropShadow="False" Foreground="{StaticResource TangoPrimaryAccentBrush}" IsBack="{Binding NavigationManager.CanNavigateBack}"> - - </touch:TouchHamburgerButton> - </Border> - <Grid DockPanel.Dock="Right" Margin="0 0 20 0"> - <StackPanel Orientation="Horizontal"> - <StackPanel x:Name="techPressElement" VerticalAlignment="Center" Background="Transparent"> - <touch:TouchGifAnimation Width="36" HorizontalAlignment="Center" EnableAnimation="True"> - <touch:TouchGifAnimation.Style> - <Style TargetType="touch:TouchGifAnimation"> - <Setter Property="Source" Value="/Images/GlobalStatus/standby.png"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.Disconnected}"> - <Setter Property="Source" Value="/Images/GlobalStatus/machine_off_Anim.gif"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.Standby}"> - <Setter Property="Source" Value="/Images/GlobalStatus/standby_Anim.gif"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.ReadyToDye}"> - <Setter Property="Source" Value="/Images/GlobalStatus/Ready_Anim.gif"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.GettingReady}"> - <Setter Property="Source" Value="/Images/GlobalStatus/getting_ready_Anim.gif"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.Printing}"> - <Setter Property="Source" Value="/Images/GlobalStatus/dyeing_Anim.gif"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchGifAnimation.Style> - </touch:TouchGifAnimation> - <TextBlock Margin="0 10 0 0" Text="{Binding MachineProvider.MachineOperator.Status,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> - </StackPanel> + <touch:TouchNotificationBar + NotificationBarVisibility="{Binding NotificationProvider.NotificationsVisible,Converter={StaticResource BooleanToVisibilityConverter}}" + HasNotifications="{Binding NotificationProvider.HasNotificationItems}" + Notifications="{Binding NotificationProvider.NotificationItems}" + ItemExpandedPropertyPath="IsExpanded"> + <touch:TouchNotificationBar.NotificationTemplate> + <DataTemplate> + <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="0" Command="{Binding PressedCommand}" components:TransformationHelper.TransformWhenPressed="False"> + <Grid> + <ContentControl Content="{Binding Converter={StaticResource ItemBaseConverter}}"/> + <touch:TouchIconButton Visibility="{Binding CanClose,Converter={StaticResource BooleanToVisibilityConverter}}" DockPanel.Dock="Right" Background="Transparent" Padding="35" Style="{StaticResource TangoRoundTouchIconButton}" Command="{Binding CloseCommand}" CommandParameter="{Binding}" HorizontalAlignment="Right" MaxHeight="90" Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}" Icon="Close" Foreground="{StaticResource TangoDarkForegroundBrush}" /> + </Grid> + </touch:TouchButton> + </DataTemplate> + </touch:TouchNotificationBar.NotificationTemplate> + <DockPanel> + <Border BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" DockPanel.Dock="Top"> + <DockPanel> + <Border BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoDividerBrush}"> + <touch:TouchHamburgerButton Width="100" Height="100" Padding="15" Command="{Binding MenuOrBackCommand}" EnableDropShadow="False" Foreground="{StaticResource TangoPrimaryAccentBrush}" IsBack="{Binding NavigationManager.CanNavigateBack}"> - <touch:TouchButton Margin="40 0 0 0" Height="65" Padding="50 0" MinWidth="200" CornerRadius="35" BlurRadius="20" Command="{Binding NotificationProvider.CurrentAppButton.Command}" IsEnabled="{Binding NotificationProvider.CurrentAppButton.IsEnabled}" Content="{Binding NotificationProvider.CurrentAppButton.Text}" Visibility="{Binding NotificationProvider.CurrentAppButton,Converter={StaticResource IsNullToVisibilityConverter}}"></touch:TouchButton> - </StackPanel> - </Grid> - <Grid> + </touch:TouchHamburgerButton> + </Border> + <Grid DockPanel.Dock="Right" Margin="0 0 20 0"> + <StackPanel Orientation="Horizontal"> + <StackPanel x:Name="techPressElement" VerticalAlignment="Center" Background="Transparent"> + <touch:TouchGifAnimation Width="36" HorizontalAlignment="Center" EnableAnimation="True"> + <touch:TouchGifAnimation.Style> + <Style TargetType="touch:TouchGifAnimation"> + <Setter Property="Source" Value="/Images/GlobalStatus/standby.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.Disconnected}"> + <Setter Property="Source" Value="/Images/GlobalStatus/machine_off_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.Standby}"> + <Setter Property="Source" Value="/Images/GlobalStatus/standby_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.ReadyToDye}"> + <Setter Property="Source" Value="/Images/GlobalStatus/Ready_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.GettingReady}"> + <Setter Property="Source" Value="/Images/GlobalStatus/getting_ready_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.Printing}"> + <Setter Property="Source" Value="/Images/GlobalStatus/dyeing_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.ShuttingDown}"> + <Setter Property="Source" Value="/Images/GlobalStatus/shutdown_icon_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.Error}"> + <Setter Property="Source" Value="/Images/GlobalStatus/error_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="{x:Static operations:MachineStatuses.Service}"> + <Setter Property="Source" Value="/Images/GlobalStatus/service_Anim.gif"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchGifAnimation.Style> + </touch:TouchGifAnimation> + <TextBlock Margin="0 10 0 0" Text="{Binding MachineProvider.MachineOperator.Status,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + </StackPanel> - <Grid Margin="20 0 60 0" Height="80" Visibility="{Binding NotificationProvider.HasAppBarItem,Converter={StaticResource BooleanToVisibilityConverter}}"> - <ContentControl Content="{Binding NotificationProvider.CurrentAppBarItem,Converter={StaticResource AppBarItemConverter}}"></ContentControl> + <touch:TouchButton Margin="40 0 0 0" Height="65" Padding="50 0" MinWidth="200" CornerRadius="35" BlurRadius="20" Command="{Binding NotificationProvider.CurrentAppButton.Command}" IsEnabled="{Binding NotificationProvider.CurrentAppButton.IsEnabled}" Content="{Binding NotificationProvider.CurrentAppButton.Text}" Visibility="{Binding NotificationProvider.CurrentAppButton,Converter={StaticResource IsNullToVisibilityConverter}}"></touch:TouchButton> + </StackPanel> </Grid> + <Grid> - <!--External Header Content Here--> - <!--<commonControls:AsyncAdornerControl> + <Grid Margin="20 0 60 0" Height="80" Visibility="{Binding NotificationProvider.HasAppBarItem,Converter={StaticResource BooleanToVisibilityConverter}}"> + <ContentControl Content="{Binding NotificationProvider.CurrentAppBarItem,Converter={StaticResource AppBarItemConverter}}"></ContentControl> + </Grid> + + <!--External Header Content Here--> + <!--<commonControls:AsyncAdornerControl> <commonControls:AsyncAdornerControl.Style> <Style TargetType="commonControls:AsyncAdornerControl"> <Setter Property="Visibility" Value="Hidden"></Setter> @@ -295,17 +321,17 @@ <touch:TouchGifAnimation Source="/Images/preloader_rectangles.gif" EnableAnimation="{Binding NotificationProvider.IsInGlobalBusyState}" /> </StackPanel> </commonControls:AsyncAdornerControl>--> - </Grid> - </DockPanel> - </Border> - - <Grid Background="{StaticResource TangoKeyboardBackground}"> - <controls:NavigationControl x:Name="NavigationControl" x:FieldModifier="public" TransitionAlwaysFades="False" TransitionType="Zoom" KeepElementsAttached="False" UseDefferedRendering="True"> - <!--MODULES GOES HERE--> - </controls:NavigationControl> - </Grid> + </Grid> + </DockPanel> + </Border> - </DockPanel> + <Grid Background="{StaticResource TangoKeyboardBackground}"> + <controls:NavigationControl x:Name="NavigationControl" x:FieldModifier="public" TransitionAlwaysFades="False" TransitionType="Zoom" KeepElementsAttached="False" UseDefferedRendering="True"> + <!--MODULES GOES HERE--> + </controls:NavigationControl> + </Grid> + </DockPanel> + </touch:TouchNotificationBar> </touch:TouchSideMenu> <Grid PreviewMouseUp="Grid_PreviewMouseUp" IsHitTestVisible="True" Background="Transparent" Visibility="{Binding ApplicationManager.IsScreenLocked,Converter={StaticResource BooleanToVisibilityConverter}}"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index 0ee8058c0..6d6d57526 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -23,25 +23,10 @@ <touch:TouchPanel HasMessageBox="{Binding NotificationProvider.HasMessageBox}" CurrentMessageBox="{Binding NotificationProvider.CurrentMessageBox}" - HasNotifications="{Binding NotificationProvider.HasNotificationItems}" - Notifications="{Binding NotificationProvider.NotificationItems}" - ItemExpandedPropertyPath="IsExpanded" HasDialog="{Binding NotificationProvider.HasDialog}" CurrentDialog="{Binding NotificationProvider.CurrentDialog}" - NotificationBarVisibility="{Binding NotificationProvider.NotificationsVisible,Converter={StaticResource BooleanToVisibilityConverter}}" IsBusy="{Binding NotificationProvider.IsInGlobalBusyState}" BusyMessage="{Binding NotificationProvider.GlobalBusyMessage}"> - <touch:TouchPanel.NotificationTemplate> - <DataTemplate> - <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="0" Command="{Binding PressedCommand}" components:TransformationHelper.TransformWhenPressed="False"> - <Grid> - <ContentControl Content="{Binding Converter={StaticResource ItemBaseConverter}}"/> - <touch:TouchIconButton Visibility="{Binding CanClose,Converter={StaticResource BooleanToVisibilityConverter}}" DockPanel.Dock="Right" Background="Transparent" Padding="35" Style="{StaticResource TangoRoundTouchIconButton}" Command="{Binding CloseCommand}" CommandParameter="{Binding}" HorizontalAlignment="Right" MaxHeight="90" Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}" Icon="Close" Foreground="{StaticResource TangoDarkForegroundBrush}" /> - </Grid> - </touch:TouchButton> - </DataTemplate> - </touch:TouchPanel.NotificationTemplate> - <touch:TouchPanel.TaskBarElement> <Border DockPanel.Dock="Top" Background="Black" Padding="5"> <DockPanel> 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> |
