diff options
Diffstat (limited to 'Software/Visual_Studio/PPC')
5 files changed, 108 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 87a1a361f..557ee8a8f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -323,6 +323,36 @@ </StackPanel> </touch:TouchExpander> + <!--SCREEN SAVER--> + <touch:TouchExpander Margin="0 20 0 0" Header="Screen Saver" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> + <StackPanel> + <controls:TableGrid Margin="10" RowHeight="60" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center"> + <Run> + Turn off the screen when the machine is turned off + </Run> + <LineBreak/> + <Run> + and no interactions are made + </Run> + </TextBlock> + <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding Settings.EnableScreenSaver}"></touch:TouchToggleSlider> + + <TextBlock VerticalAlignment="Bottom">Turn off screen delay (m)</TextBlock> + <touch:TouchNumericTextBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="5" Maximum="60" Value="{Binding Settings.ScreenSaverStartDuration}" HasDecimalPoint="False" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox> + + </controls:TableGrid> + + <DockPanel Margin="10 -50 0 0"> + <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> + You can activate the screen anytime by pressing + </TextBlock> + </DockPanel> + </StackPanel> + </touch:TouchExpander> + + <!--TECHNICIAN--> <touch:TouchExpander Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 20 0 0" Header="Advanced" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> <StackPanel Margin="10 30 10 10"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index fce1ce046..ba7499cc1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -322,6 +322,24 @@ namespace Tango.PPC.Common public int FineTuningTrialLengthMeters { get; set; } /// <summary> + /// Gets or sets a value indicating whether to enable the screen saver. + /// </summary> + public bool EnableScreenSaver { get; set; } + + private int _screenSaverStartDuration; + /// <summary> + /// Gets or sets the start duration of the screen saver. + /// </summary> + public int ScreenSaverStartDuration + { + get { return _screenSaverStartDuration; } + set + { + _screenSaverStartDuration = Math.Max(value, 1); + } + } + + /// <summary> /// Gets the machine service address. /// </summary> /// <returns></returns> @@ -384,6 +402,8 @@ namespace Tango.PPC.Common EnableProxifier = true; UseJobsModuleV2 = true; DefaultTabColorSpace = ColorSpaces.CMYK; + ScreenSaverStartDuration = 5; + EnableScreenSaver = true; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index 9dc4684c2..9a302a6ff 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -23,6 +23,8 @@ using Tango.SharedUI; using System.Data.Entity; using Tango.PPC.UI.AppBarItems; using Tango.PPC.Common.Notifications.NotificationItems; +using Tango.Core.Commands; +using System.Timers; namespace Tango.PPC.UI.ViewModels { @@ -38,6 +40,7 @@ namespace Tango.PPC.UI.ViewModels private PowerUpAppBarItem _powerUpAppBar; private bool _started; private MessageNotificationItem _headTypeNotification; + private Timer _screenSaverTimer; private DateTime _currentDateTime; /// <summary> @@ -49,6 +52,15 @@ namespace Tango.PPC.UI.ViewModels set { _currentDateTime = value; RaisePropertyChangedAuto(); } } + private bool _isScreenSaverOn; + public bool IsScreenSaverOn + { + get { return _isScreenSaverOn; } + set { _isScreenSaverOn = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand ScreenSaverExitCommand { get; set; } + public MainViewVM() { _date_timer = new DispatcherTimer(); @@ -61,6 +73,8 @@ namespace Tango.PPC.UI.ViewModels _headTypeNotification.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Error; _headTypeNotification.Priority = NotificationItem.NotificationPriority.Critical; _headTypeNotification.Message = "Machine head type mismatch."; + + ScreenSaverExitCommand = new RelayCommand(ResetScreenSaverTimer); } /// <summary> @@ -84,6 +98,10 @@ namespace Tango.PPC.UI.ViewModels MachineProvider.MachineOperator.PowerUpEnded += MachineOperator_PowerUpEnded; MachineProvider.MachineConnected += MachineProvider_MachineConnected; + + _screenSaverTimer = new Timer(TimeSpan.FromMinutes(Settings.ScreenSaverStartDuration).TotalMilliseconds); + _screenSaverTimer.Elapsed += _screenSaverTimer_Elapsed; + _screenSaverTimer.Start(); } #region Power Up @@ -262,6 +280,8 @@ namespace Tango.PPC.UI.ViewModels private void MachineProvider_MachineConnected(object sender, EventArgs e) { + ResetScreenSaverTimer(); + NotificationProvider.PopNotification(_headTypeNotification); if (MachineProvider.MachineOperator.DeviceInformation != null && !MachineProvider.Machine.IsDemo) @@ -275,5 +295,26 @@ namespace Tango.PPC.UI.ViewModels } #endregion + + #region Screen Saver + + public void ResetScreenSaverTimer() + { + _screenSaverTimer.Stop(); + _screenSaverTimer.Start(); + IsScreenSaverOn = false; + } + + private void _screenSaverTimer_Elapsed(object sender, ElapsedEventArgs e) + { + _screenSaverTimer.Interval = TimeSpan.FromMinutes(Settings.ScreenSaverStartDuration).TotalMilliseconds; + + if (Settings.EnableScreenSaver && !MachineProvider.IsConnected) + { + IsScreenSaverOn = true; + } + } + + #endregion } } 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 2e36347a3..0d59961cc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -13,6 +13,7 @@ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:components="clr-namespace:Tango.Touch.Components;assembly=Tango.Touch" xmlns:localConverters="clr-namespace:Tango.PPC.UI.Converters" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> @@ -20,7 +21,13 @@ <localConverters:ItemBaseConverter x:Key="ItemBaseConverter" /> </UserControl.Resources> - <Grid> + <Grid Background="Transparent"> + <i:Interaction.Triggers> + <i:EventTrigger EventName="PreviewMouseUp"> + <i:InvokeCommandAction Command="{Binding ScreenSaverExitCommand}" /> + </i:EventTrigger> + </i:Interaction.Triggers> + <touch:TouchPanel HasMessageBox="{Binding NotificationProvider.HasMessageBox}" CurrentMessageBox="{Binding NotificationProvider.CurrentMessageBox}" @@ -147,5 +154,13 @@ <local:RestartingView></local:RestartingView> </controls:NavigationControl> </touch:TouchPanel> + + <Grid Visibility="{Binding IsScreenSaverOn,Converter={StaticResource BooleanToVisibilityConverter}}" Background="Black"> + <i:Interaction.Triggers> + <i:EventTrigger EventName="PreviewMouseUp"> + <i:InvokeCommandAction Command="{Binding ScreenSaverExitCommand}" /> + </i:EventTrigger> + </i:Interaction.Triggers> + </Grid> </Grid> </UserControl> 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> |
