diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-07-02 15:26:42 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-07-02 15:26:42 +0300 |
| commit | 167252d9517377a4169cd389ca7187509b5a0c1d (patch) | |
| tree | 61511ee2e70fea2dfb182dde8bb21f0ef37b8376 /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | e63a5e3c82324c0a1afc4d27370a99230243ac11 (diff) | |
| download | Tango-167252d9517377a4169cd389ca7187509b5a0c1d.tar.gz Tango-167252d9517377a4169cd389ca7187509b5a0c1d.zip | |
UI Power options: Close application and minimize.
Related Work Items: #8675
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
5 files changed, 50 insertions, 12 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml index f5b1116c0..3ef594046 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml @@ -6,7 +6,7 @@ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Dialogs" mc:Ignorable="d" - Width="500" Height="462" + Width="500" Height="625" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="500" d:DataContext="{d:DesignInstance Type=local:PowerEurekaViewVM, IsDesignTimeCreatable=False}"> <UserControl.Resources> @@ -36,17 +36,27 @@ <touch:TouchIconButton DockPanel.Dock="Right" VerticalAlignment="Center" Height="25" Width="25" Command="{Binding CloseCommand}" Foreground="{StaticResource TangoDarkForegroundBrush}" RippleBrush="{StaticResource TangoRippleDarkBrush}" Icon="Close" HorizontalAlignment="Right" /> <TextBlock FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" HorizontalAlignment="Center"> Power</TextBlock> </DockPanel> - <Grid HorizontalAlignment="Center" Width="470" VerticalAlignment="Top" Margin="0 20 0 0"> - <Image Source="../Images/Menu/Power_image.png" Stretch="UniformToFill" VerticalAlignment="Center" HorizontalAlignment="Left" Height="50" Width="120"/> - <touch:TouchButton Margin="0" Command="{Binding TurnOffCommand}" HorizontalAlignment="Center"> Turn off</touch:TouchButton> - </Grid> - <touch:TouchButton Margin="0 35 0 0" Content="Stand By" Command="{Binding StandByCommand}" ></touch:TouchButton> - <touch:TouchButton Margin="0 35 0 0" Command="{Binding RestartCommand}">Restart</touch:TouchButton> + <UniformGrid Rows="3" > + <Grid VerticalAlignment="Top" Margin="0 30 0 0"> + <Image Source="../Images/Menu/AppPower_image.png" Stretch="UniformToFill" HorizontalAlignment="Left" Width="120" VerticalAlignment="Center" Margin="0 0 0 0"/> + <touch:TouchButton Margin="0" Command="{Binding MinimizeCommand}">Minimize</touch:TouchButton> + </Grid> + <touch:TouchButton Margin="0 35 0 0" Command="{Binding RestartTabletCommand}">Restart UI</touch:TouchButton> + <touch:TouchButton Margin="0 35 0 0" Command="{Binding CloseAppCommand}">Close</touch:TouchButton> + </UniformGrid> + <Border Height="2" Width="380" Background="{StaticResource TangoLightBorderBrush}" VerticalAlignment="Bottom" Margin="0 36 0 0" CornerRadius="2"></Border> - <Grid Margin="0 43 0 43" VerticalAlignment="Bottom"> - <Image Source="../Images/Menu/restart_t.png" Stretch="UniformToFill" HorizontalAlignment="Left" Width="30" VerticalAlignment="Center" Margin="46 0 0 0"/> - <touch:TouchButton Margin="0" Command="{Binding RestartTabletCommand}">Restart</touch:TouchButton> - </Grid> + + <UniformGrid Rows="3"> + <Grid HorizontalAlignment="Center" Width="470" VerticalAlignment="Top" Margin="0 30 0 0"> + <Image Source="../Images/Menu/Power_image.png" Stretch="UniformToFill" VerticalAlignment="Center" HorizontalAlignment="Left" Height="50" Width="120"/> + <touch:TouchButton Margin="0" Command="{Binding StandByCommand}" HorizontalAlignment="Center">Power Save</touch:TouchButton> + </Grid> + <touch:TouchButton Margin="0 35 0 0" Command="{Binding RestartCommand}">Restart FW</touch:TouchButton> + <touch:TouchButton Margin="0 35 0 0" Content="Turn Off" Command="{Binding TurnOffCommand}" ></touch:TouchButton> + + </UniformGrid> + </StackPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs index 2dc8f7b6e..292c4b2d6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using Tango.Core.Commands; using Tango.SharedUI; @@ -10,7 +11,7 @@ namespace Tango.PPC.UI.Dialogs { public class PowerEurekaViewVM : DialogViewVM { - public enum PowerActionEnum { TurnOff, StandBy, Restart, RestartT }; + public enum PowerActionEnum { TurnOff, StandBy, Restart, RestartT, CloseApp }; private PowerActionEnum _powerAction; @@ -26,6 +27,8 @@ namespace Tango.PPC.UI.Dialogs public RelayCommand StandByCommand { get; set;} public RelayCommand RestartCommand { get; set; } public RelayCommand RestartTabletCommand { get; set; } + public RelayCommand MinimizeCommand { get; set; } + public RelayCommand CloseAppCommand { get; set; } public PowerEurekaViewVM() @@ -35,6 +38,19 @@ namespace Tango.PPC.UI.Dialogs StandByCommand = new RelayCommand(OnStandBy); RestartCommand = new RelayCommand(OnRestart); RestartTabletCommand = new RelayCommand(OnRestartTablet); + MinimizeCommand = new RelayCommand(OnMinimize); + CloseAppCommand = new RelayCommand(OnCloseApp); + } + + private void OnCloseApp(object obj) + { + PowerAction = PowerActionEnum.CloseApp; + base.Accept(); + } + + private void OnMinimize(object obj) + { + Application.Current.MainWindow.WindowState = WindowState.Minimized; } private void OnRestartTablet(object obj) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png Binary files differnew file mode 100644 index 000000000..e81b56d37 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png 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 f5d3502c0..e364c530c 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 @@ -644,6 +644,7 @@ <Resource Include="Images\Overview Icons\pr_data.png" /> <Resource Include="Images\Overview Icons\temperature.png" /> <Resource Include="Images\screw.png" /> + <Resource Include="Images\Menu\AppPower_image.png" /> <Content Include="Intro.wmv" /> <Content Include="Manifests\release.xml" /> <Content Include="Manifests\debug.xml" /> 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 f40a89f42..17b676499 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -361,6 +361,9 @@ namespace Tango.PPC.UI.ViewModels if (MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected) ResetMachine(); return; + case PowerEurekaViewVM.PowerActionEnum.CloseApp: + CloseApplication(); + return; default: return; } @@ -455,6 +458,14 @@ namespace Tango.PPC.UI.ViewModels } } + private async void CloseApplication() + { + if (await NotificationProvider.ShowQuestion("Are you sure you want to close the application?")) + { + ApplicationManager.ShutDown(); + } + } + /// <summary> /// Powers off the machine. /// </summary> |
