From f73b3b8043e4f9183a5450afdbb99bcde1b63ff1 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 16 Feb 2021 17:15:16 +0200 Subject: Short cycle mode done. --- .../ViewModels/MaintenanceViewVM.cs | 57 ++++++++++++++++++++++ .../Views/MaintenanceView.xaml | 2 + 2 files changed, 59 insertions(+) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs index 1279a0ba4..ae08f7f19 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs @@ -92,6 +92,13 @@ namespace Tango.PPC.Maintenance.ViewModels set { _wasteStates = value; RaisePropertyChangedAuto(); } } + private bool _isInkAutoFillingDisabled; + public bool IsInkAutoFillingDisabled + { + get { return _isInkAutoFillingDisabled; } + set { _isInkAutoFillingDisabled = value; RaisePropertyChangedAuto(); OnInkAutoFillingChanged(); } + } + public RelayCommand ExportLogsCommand { get; set; } public OpenCloseDyeingHeadCommand OpenCloseDyeingHeadCommand { get; set; } @@ -180,6 +187,8 @@ namespace Tango.PPC.Maintenance.ViewModels UpdateMidTankLevels(status); OverallTemperature.Temperature = status.OverallTemperature; SpoolState = status.SpoolState; + _isInkAutoFillingDisabled = status.AutoInkFillingDisabled; + RaisePropertyChanged(nameof(IsInkAutoFillingDisabled)); InvalidateRelayCommands(); } @@ -320,5 +329,53 @@ namespace Tango.PPC.Maintenance.ViewModels { await NotificationProvider.ShowDialog(); } + + private async void OnInkAutoFillingChanged() + { + if (IsInkAutoFillingDisabled) + { + try + { + NotificationProvider.SetGlobalBusyMessage("Disabling auto ink filling..."); + await MachineProvider.MachineOperator.SendRequest(new SetInkAutoFillingModeRequest() + { + Disabled = true + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error disabling ink filling."); + _isInkAutoFillingDisabled = false; + RaisePropertyChanged(nameof(IsInkAutoFillingDisabled)); + await NotificationProvider.ShowError($"Error disabling auto ink filling.\n{ex.Message}"); + } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + } + } + else + { + try + { + NotificationProvider.SetGlobalBusyMessage("Enabling auto ink filling..."); + await MachineProvider.MachineOperator.SendRequest(new SetInkAutoFillingModeRequest() + { + Disabled = false + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error enabling ink filling."); + _isInkAutoFillingDisabled = true; + RaisePropertyChanged(nameof(IsInkAutoFillingDisabled)); + await NotificationProvider.ShowError($"Error enabling auto ink filling.\n{ex.Message}"); + } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + } + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml index 9d88f59ca..5534b1315 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml @@ -258,6 +258,8 @@ DISPENSE CLEANING LIQUID EXPORT SYSTEM LOGS + + -- cgit v1.3.1