diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-01-19 19:47:50 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-01-19 19:47:50 +0200 |
| commit | 97904f88f3949339c713286b592ad156baa8d41f (patch) | |
| tree | 28437b18fba7572ba0b390c668c48c28594d2c97 /Software/Visual_Studio/PPC | |
| parent | dc01eecbfd2f47f739e4ffd8a2a56f3047c66322 (diff) | |
| download | Tango-97904f88f3949339c713286b592ad156baa8d41f.tar.gz Tango-97904f88f3949339c713286b592ad156baa8d41f.zip | |
Buzzer.
White Skip.
Thread Loading Abort.
Diffstat (limited to 'Software/Visual_Studio/PPC')
5 files changed, 77 insertions, 4 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 7f145c1e3..8a29b2f8b 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 @@ -307,7 +307,7 @@ namespace Tango.PPC.MachineSettings.ViewModels get { return _selectedIdleTime; } set { _selectedIdleTime = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(PowerOffTimeVisible)); } } - + public bool PowerOffTimeVisible { get { return SelectedIdleTime.Minutes != Common.PowerSavingModes.Never; } @@ -413,6 +413,16 @@ namespace Tango.PPC.MachineSettings.ViewModels catch { } } + if (MachineProvider.IsConnected) + { + try + { + await MachineProvider.MachineOperator.SetBuzzerSettings(Settings.EnableBuzzer, Settings.BuzzerDuration); + await MachineProvider.MachineOperator.SetWhiteThreadSkip(Settings.EnableWhiteThreadSkip); + } + catch { } + } + if (_previousTimeZone.ToStringSafe() != SelectedTimeZone.ToStringSafe()) { if (await NotificationProvider.ShowQuestion("Changing the time zone requires the application to restart. Do you wish to restart the application?")) 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 537d354fd..e6a21d826 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 @@ -183,6 +183,15 @@ <TextBlock Visibility="{Binding BuildProvider.IsEureka,Converter={StaticResource BooleanToVisibilityConverter}}" VerticalAlignment="Bottom">Display Jerrycan popup when inserted</TextBlock> <touch:TouchToggleSlider Visibility="{Binding BuildProvider.IsEureka,Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource TangoToggleButtonGrayAccent}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="90" IsChecked="{Binding Settings.EnableJerricanChangePopup}" KeyboardNavigation.TabNavigation ="None" IsTabStop="False"></touch:TouchToggleSlider> + + <TextBlock VerticalAlignment="Bottom">Enable Machine Buzzer</TextBlock> + <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="90" IsChecked="{Binding Settings.EnableBuzzer}" KeyboardNavigation.TabNavigation ="None" IsTabStop="False"></touch:TouchToggleSlider> + + <TextBlock VerticalAlignment="Bottom">Machine Buzzer Duration</TextBlock> + <touch:TouchNumericTextBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="10" Maximum="180" Value="{Binding Settings.BuzzerDuration}" HasDecimalPoint="False" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox> + + <TextBlock VerticalAlignment="Bottom">Enable White Thread Trimming Feature</TextBlock> + <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="90" IsChecked="{Binding Settings.EnableWhiteThreadSkip}" KeyboardNavigation.TabNavigation ="None" IsTabStop="False"></touch:TouchToggleSlider> </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 3446fe55d..bc96e4eba 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -448,15 +448,19 @@ namespace Tango.PPC.Common.Connection MachineConnected?.Invoke(this, new EventArgs()); + var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + if (Machine.Type.IsXMachine()) { try { - var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); await MachineOperator.SetPowerSavingMode((int)settings.PowerSavingModeIdle, (int)settings.PowerSavingModePowerOff); } catch { } } + + await MachineOperator.SetBuzzerSettings(settings.EnableBuzzer, settings.BuzzerDuration); + await MachineOperator.SetWhiteThreadSkip(settings.EnableWhiteThreadSkip); } /// <summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index da39b40ec..55a8be975 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -419,10 +419,27 @@ namespace Tango.PPC.Common public SMSNotificationSettings SMSNotificationSettings { get; set; } /// <summary> + /// Gets or sets a value indicating whether to enable the machine buzzer. + /// </summary> + public bool EnableBuzzer { get; set; } + + /// <summary> + /// Gets or sets the duration of the machine buzzer. + /// </summary> + public int BuzzerDuration { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether enable white thread skip. + /// </summary> + public bool EnableWhiteThreadSkip { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="PPCSettings"/> class. /// </summary> public PPCSettings() { + EnableWhiteThreadSkip = false; + BuzzerDuration = 30; EnableJerricanChangePopup = true; PowerSavingModeIdle = PowerSavingModes.Default; PowerSavingModePowerOff = PowerSavingModes.Maximum; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs index cc8f867cc..aea423c12 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ThreadLoading/DefaultThreadLoadingService.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core.DI; using Tango.Integration.Operation; +using Tango.Logging; using Tango.PPC.Common.Build; using Tango.PPC.Common.Connection; using Tango.PPC.Common.Notifications; @@ -37,8 +38,24 @@ namespace Tango.PPC.UI.ThreadLoading _dialogShown = true; _dispatcher.Invoke(async () => { - await _notificationsProvider.ShowDialog<ThreadLoadingViewVM>(new ThreadLoadingViewVM()); + var vm = await _notificationsProvider.ShowDialog<ThreadLoadingViewVM>(new ThreadLoadingViewVM()); _dialogShown = false; + if (!vm.DialogResult && vm.Stage != ThreadLoadingViewVM.ThreadLoadingStage.Completed) + { + if (_machineProvider.IsConnected) + { + try + { + await _machineProvider.MachineOperator.AbortThreadLoading(); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, "Error aborting thread loading."); + } + + await _notificationsProvider.ShowInfo("Thread loading aborted."); + } + } }); } } @@ -46,8 +63,24 @@ namespace Tango.PPC.UI.ThreadLoading public async void StartThreadLoadingWizard() { _dialogShown = true; - await _notificationsProvider.ShowDialog<ThreadLoadingViewVM>(new ThreadLoadingViewVM(true)); + var vm = await _notificationsProvider.ShowDialog<ThreadLoadingViewVM>(new ThreadLoadingViewVM(true)); _dialogShown = false; + if (!vm.DialogResult && vm.Stage != ThreadLoadingViewVM.ThreadLoadingStage.Completed) + { + if (_machineProvider.IsConnected) + { + try + { + await _machineProvider.MachineOperator.AbortThreadLoading(); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, "Error aborting thread loading."); + } + + await _notificationsProvider.ShowInfo("Thread loading aborted."); + } + } } public async void StartThreadBreakWizard() |
