From b7f4088f257c3c9c816f680c97a652f6f73de940 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 18 Feb 2020 14:31:24 +0200 Subject: Several bug fixes on PPC. --- Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs index f926a0f4c..e280d5f9d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -96,12 +96,14 @@ namespace Tango.PPC.UI.ViewModels LogManager.Log($"Application started. Single user/Auto login detected ({user.Email}). Skipping LoginView..."); await AuthenticationProvider.Login(user.Email, user.Password, false); + await Task.Delay(1000); IsLoading = false; } else { LogManager.Log("Application started. Navigating to LoginView..."); await NavigationManager.NavigateTo(NavigationView.LoginView); + await Task.Delay(1000); IsLoading = false; } } -- cgit v1.3.1 From 00b7de2653058bd9657217075eae834f6a1a4ec5 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 18 Feb 2020 16:26:46 +0200 Subject: Implemented PPC thread loading from preparation.. --- .../Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml | 22 ++++++++---- .../Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs | 27 +++++++++++++-- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 38 ++++++++++++++++++--- .../Software Release Notes (4.1, 1.1).docx | Bin 0 -> 9504602 bytes .../Release Notes/Transparent Colors.docx | Bin 0 -> 214687 bytes .../Software Release Notes (4.1, 1.1).docx | Bin 9706563 -> 0 bytes .../Tango.Emulations/Emulators/MachineEmulator.cs | 14 ++++++-- .../Tango.Integration/Operation/MachineOperator.cs | 1 + .../Tango.Touch/Controls/TouchPanel.xaml | 2 +- 9 files changed, 87 insertions(+), 17 deletions(-) create mode 100644 Software/Visual_Studio/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx create mode 100644 Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx delete mode 100644 Software/Visual_Studio/Resources/Software Release Notes (4.1, 1.1).docx (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml index f6fc7704a..d6db3d124 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml @@ -14,16 +14,24 @@ Thread Loading - - + + + The machine is ready for thread loading. Please load the thread as instructed and press 'continue'. - - - CONTINUE + + + CONTINUE + + + + The machine is now loading the thread. please wait... + + + - + - The machine is now loading the thread. please wait... + The machine is now preparing for thread loading. please wait... diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs index 5e5370416..5c4d003a1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs @@ -40,6 +40,13 @@ namespace Tango.PPC.UI.Dialogs set { _isFinalizing = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + private bool _isPreparing; + public bool IsPreparing + { + get { return _isPreparing; } + set { _isPreparing = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + public List Rmls { get; set; } private Rml _selectedRml; @@ -51,15 +58,28 @@ namespace Tango.PPC.UI.Dialogs public RelayCommand ContinueCommand { get; set; } - public ThreadLoadingViewVM(IMachineProvider machineProvider, ThreadLoadingConfirmationRequiredEventArgs confirmationArgs) + public ThreadLoadingViewVM(IMachineProvider machineProvider) { CanClose = true; - _confirmationArgs = confirmationArgs; + IsPreparing = true; ContinueCommand = new RelayCommand(ContinueThreadLoading, () => !IsFinalizing && SelectedRml != null); MachineProvider = machineProvider; MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged; MachineProvider.MachineOperator.ThreadLoadingCompleted += MachineOperator_ThreadLoadingCompleted; MachineProvider.MachineOperator.ThreadLoadingFailed += MachineOperator_ThreadLoadingFailed; + MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired += MachineOperator_ThreadLoadingConfirmationRequired; + } + + public ThreadLoadingViewVM(IMachineProvider machineProvider, ThreadLoadingConfirmationRequiredEventArgs confirmationArgs) : this(machineProvider) + { + _confirmationArgs = confirmationArgs; + IsPreparing = false; + } + + private void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e) + { + _confirmationArgs = e; + IsPreparing = false; } private async void ContinueThreadLoading() @@ -125,7 +145,7 @@ namespace Tango.PPC.UI.Dialogs { Status = e; - if(Status.State == ThreadLoadingState.Finalizing) + if (Status.State == ThreadLoadingState.Finalizing) { IsFinalizing = true; } @@ -150,6 +170,7 @@ namespace Tango.PPC.UI.Dialogs MachineProvider.MachineOperator.ThreadLoadingStatusChanged -= MachineOperator_ThreadLoadingStatusChanged; MachineProvider.MachineOperator.ThreadLoadingCompleted -= MachineOperator_ThreadLoadingCompleted; MachineProvider.MachineOperator.ThreadLoadingFailed -= MachineOperator_ThreadLoadingFailed; + MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired -= MachineOperator_ThreadLoadingConfirmationRequired; } } } 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 5c518f60d..048234949 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -32,6 +32,7 @@ namespace Tango.PPC.UI.ViewModels { private DispatcherTimer _date_timer; private bool _isPowerUpDialogShown; + private bool _isThreadLoadingShown; private DateTime _currentDateTime; /// @@ -64,6 +65,7 @@ namespace Tango.PPC.UI.ViewModels base.OnApplicationReady(); MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived; MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted; + MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged; MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired += MachineOperator_ThreadLoadingConfirmationRequired; } @@ -187,12 +189,30 @@ namespace Tango.PPC.UI.ViewModels }); } - private async void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e) + private void MachineOperator_ThreadLoadingStatusChanged(object sender, PMR.ThreadLoading.StartThreadLoadingResponse e) { - LogManager.Log("Thread loading confirmation detected, showing thread loading screen..."); + if (e.State == PMR.ThreadLoading.ThreadLoadingState.Preparing) + { + DisplayThreadLoading(); + } + } + + private void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e) + { + DisplayThreadLoading(e); + } + + private async void DisplayThreadLoading(ThreadLoadingConfirmationRequiredEventArgs confirmationArgs = null) + { + if (_isThreadLoadingShown) return; + + _isThreadLoadingShown = true; + + LogManager.Log("Thread loading preparation/finalization detected, showing thread loading screen..."); if (!Settings.DisplayAutomaticThreadLoadingScreen) { + _isThreadLoadingShown = false; LogManager.Log("Thread loading screen disabled. skipping..."); return; } @@ -212,12 +232,21 @@ namespace Tango.PPC.UI.ViewModels var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LoadedRmlGuid); - vm = new ThreadLoadingViewVM(MachineProvider, e); + if (confirmationArgs == null) + { + vm = new ThreadLoadingViewVM(MachineProvider); + } + else + { + vm = new ThreadLoadingViewVM(MachineProvider, confirmationArgs); + } + vm.Rmls = rmls; vm.SelectedRml = selectedRml != null ? selectedRml : rmls.FirstOrDefault(); } catch (Exception ex) { + _isThreadLoadingShown = false; LogManager.Log(ex, "Error initializing thread loading screen."); return; } @@ -226,6 +255,8 @@ namespace Tango.PPC.UI.ViewModels { await NotificationProvider.ShowDialog(vm); + _isThreadLoadingShown = false; + LogManager.Log("Thread loading screen closed."); if (!vm.DialogResult) @@ -257,7 +288,6 @@ namespace Tango.PPC.UI.ViewModels } }); } - #endregion } } diff --git a/Software/Visual_Studio/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx b/Software/Visual_Studio/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx new file mode 100644 index 000000000..d6ebf5330 Binary files /dev/null and b/Software/Visual_Studio/Resources/Release Notes/Software Release Notes (4.1, 1.1).docx differ diff --git a/Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx b/Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx new file mode 100644 index 000000000..849600e3e Binary files /dev/null and b/Software/Visual_Studio/Resources/Release Notes/Transparent Colors.docx differ diff --git a/Software/Visual_Studio/Resources/Software Release Notes (4.1, 1.1).docx b/Software/Visual_Studio/Resources/Software Release Notes (4.1, 1.1).docx deleted file mode 100644 index 7e6ff1e00..000000000 Binary files a/Software/Visual_Studio/Resources/Software Release Notes (4.1, 1.1).docx and /dev/null differ diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index b901bd224..17a7fbe58 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -1543,7 +1543,17 @@ namespace Tango.Emulations.Emulators public async void StartThreadLoading() { - await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.ReadyForLoading }, _threadLoadingToken); + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.Preparing }, _threadLoadingToken); + await Task.Delay(2000); + + if (_rnd.Next(0, 100) > 50) + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.PreparationError, ErrorReason = "Emulator preparation random error." }, _threadLoadingToken); + } + else + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.ReadyForLoading }, _threadLoadingToken); + } } public async void FinalizeThreadLoading() @@ -1557,7 +1567,7 @@ namespace Tango.Emulations.Emulators } else { - await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator random error." }, _threadLoadingToken); + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator finalization random error." }, _threadLoadingToken); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 80ba87ce1..5711882a3 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -949,6 +949,7 @@ namespace Tango.Integration.Operation ThreadLoadingCompleted?.Invoke(this, ThreadLoadingStatus); break; case ThreadLoadingState.FinalizationError: + case ThreadLoadingState.PreparationError: ThreadLoadingFailed?.Invoke(this, ThreadLoadingStatus); break; } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml index ffe3d19dd..8a5367234 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml @@ -66,7 +66,7 @@ - + -- cgit v1.3.1