aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2020-02-19 10:32:48 +0200
committerAvi Levkovich <avi@twine-s.com>2020-02-19 10:32:48 +0200
commit685b1da155bda741a3378a1c19a04ffd110a0a33 (patch)
treee38a3740bf4727dfa9368c6010c6cd55d6910ffb /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
parent94fccc66fd2b8b6aed1371546dfd8cef68d5e60d (diff)
parentbb51ac752b58b3d64e86a8150e7a9b1f5749e379 (diff)
downloadTango-685b1da155bda741a3378a1c19a04ffd110a0a33.tar.gz
Tango-685b1da155bda741a3378a1c19a04ffd110a0a33.zip
merge conflict
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs38
2 files changed, 36 insertions, 4 deletions
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;
}
}
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;
/// <summary>
@@ -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<ThreadLoadingViewVM>(vm);
+ _isThreadLoadingShown = false;
+
LogManager.Log("Thread loading screen closed.");
if (!vm.DialogResult)
@@ -257,7 +288,6 @@ namespace Tango.PPC.UI.ViewModels
}
});
}
-
#endregion
}
}