diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-05-22 17:05:24 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-05-22 17:05:24 +0300 |
| commit | ff6e448a675de210bb39ef68a7e021a9d62e0473 (patch) | |
| tree | fc69edfbd6e470f3544e9b36d0cb2c9168dad9a7 /Software/Visual_Studio | |
| parent | b9858454b21aa53f818a5a148e8ad1e75d13a83d (diff) | |
| download | Tango-ff6e448a675de210bb39ef68a7e021a9d62e0473.tar.gz Tango-ff6e448a675de210bb39ef68a7e021a9d62e0473.zip | |
Power Saving Mode.
Diffstat (limited to 'Software/Visual_Studio')
4 files changed, 21 insertions, 10 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index f6b31d93c..ed855d7b0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -305,9 +305,13 @@ namespace Tango.PPC.MachineSettings.ViewModels public PowerDownTime SelectedIdleTime { get { return _selectedIdleTime; } - set { _selectedIdleTime = value; RaisePropertyChangedAuto(); } + set { _selectedIdleTime = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(PowerOffTimeVisible)); } + } + + public bool PowerOffTimeVisible + { + get { return SelectedIdleTime.Minutes != Common.PowerSavingModes.Never; } } - #endregion @@ -396,7 +400,7 @@ namespace Tango.PPC.MachineSettings.ViewModels await MachineProvider.MachineOperator.SetSpoolType((PMR.Printing.JobSpoolType)SelectedSpoolType.Code); } - if (MachineProvider.IsConnected) + if (MachineProvider.IsConnected && BuildProvider.IsEureka) { try { 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 3e2eff01c..9dd37ae73 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 @@ -370,8 +370,8 @@ <TextBlock VerticalAlignment="Center">Machine goes to idle mode automatically after</TextBlock> <touch:TouchComboBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="250" ItemsSource="{Binding PowerSavingModes}" SelectedItem="{Binding SelectedIdleTime}" ValuePath="Minutes" DisplayMemberPath="Name"></touch:TouchComboBox> - <TextBlock VerticalAlignment="Center">Power off the machine when idle for</TextBlock> - <touch:TouchComboBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="250" ItemsSource="{Binding PowerSavingModes}" SelectedItem="{Binding SelectedPowerOffTime}" ValuePath="Minutes" DisplayMemberPath="Name"></touch:TouchComboBox> + <TextBlock Visibility="{Binding PowerOffTimeVisible,Converter={StaticResource BooleanToVisibilityConverter}}" VerticalAlignment="Center">Power off the machine when idle for</TextBlock> + <touch:TouchComboBox Visibility="{Binding PowerOffTimeVisible,Converter={StaticResource BooleanToVisibilityConverter}}" VerticalAlignment="Top" HorizontalAlignment="Right" Width="250" ItemsSource="{Binding PowerSavingModes}" SelectedItem="{Binding SelectedPowerOffTime}" ValuePath="Minutes" DisplayMemberPath="Name"></touch:TouchComboBox> </controls:TableGrid> <!--<DockPanel Margin="10 -50 0 0"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index 2539985c5..db5085b09 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -448,12 +448,15 @@ namespace Tango.PPC.Common.Connection MachineConnected?.Invoke(this, new EventArgs()); - try + if (Machine.Type == BL.Enumerations.MachineTypes.Eureka) { - var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); - await MachineOperator.SetPowerSavingMode((int)settings.PowerSavingModeIdle, (int)settings.PowerSavingModePowerOff); + try + { + var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + await MachineOperator.SetPowerSavingMode((int)settings.PowerSavingModeIdle, (int)settings.PowerSavingModePowerOff); + } + catch { } } - catch { } } /// <summary> diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 870541394..85bea26bb 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -4712,7 +4712,11 @@ namespace Tango.Integration.Operation try { LogManager.Log($"Settings machine power saving mode to {timeToIdleMinutes},{timeToPowerDownMinutes} minutes..."); - var r = await SendRequest<SetPowerDownTimeRequest, SetPowerDownTimeResponse>(new SetPowerDownTimeRequest() { TimeToPowerOffMinutes = timeToPowerDownMinutes }); + var r = await SendRequest<SetPowerDownTimeRequest, SetPowerDownTimeResponse>(new SetPowerDownTimeRequest() + { + TimeToIdleMinutes = timeToIdleMinutes, + TimeToPowerOffMinutes = timeToPowerDownMinutes + }); } catch (Exception ex) { |
