aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-09-14 13:47:34 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-09-14 13:47:34 +0300
commit89ffc630471605c4757b5854af3d73b5b75e98d6 (patch)
treed83f1196b233560edd37d08d7d00810a7e6d5a32 /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
parent0cfa44b16e412c7fbe1069d0cc83dfed486403b3 (diff)
downloadTango-89ffc630471605c4757b5854af3d73b5b75e98d6.tar.gz
Tango-89ffc630471605c4757b5854af3d73b5b75e98d6.zip
New thread loading wizard.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs97
1 files changed, 5 insertions, 92 deletions
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 3b45a0c2b..05fb610c8 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
@@ -236,102 +236,15 @@ namespace Tango.PPC.UI.ViewModels
private void MachineOperator_ThreadLoadingStatusChanged(object sender, PMR.ThreadLoading.StartThreadLoadingResponse e)
{
- if (e.State == PMR.ThreadLoading.ThreadLoadingState.Preparing)
- {
- DisplayThreadLoading();
- }
+ //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;
- }
-
- ThreadLoadingViewVM vm;
-
- try
- {
- LogManager.Log("Loading site rmls...");
-
- List<Rml> rmls = new List<Rml>();
-
- using (ObservablesContext db = ObservablesContext.CreateDefault())
- {
- rmls = await new RmlsCollectionBuilder(db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).WithActiveParametersGroup().BuildListAsync();
- }
-
- var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LoadedRmlGuid);
-
- 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;
- }
-
- InvokeUI(async () =>
- {
- await NotificationProvider.ShowDialog<ThreadLoadingViewVM>(vm);
-
- _isThreadLoadingShown = false;
-
- LogManager.Log("Thread loading screen closed.");
-
- if (!vm.DialogResult)
- {
- LogManager.Log("Thread loading screen aborted by user. No operation was performed.");
- return;
- }
-
- try
- {
- if (vm.Result.IsCompleted)
- {
- await NotificationProvider.ShowSuccess("Thread loading completed successfully.");
- }
- else
- {
- await NotificationProvider.ShowError($"Thread loading failed due to the following reason:\n{vm.Result.FailedException.FlattenException()}");
- }
-
- if (vm.SelectedRml != null)
- {
- Settings.LoadedRmlGuid = vm.SelectedRml.Guid;
- Settings.Save();
- }
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, "Error occurred after thread loading screen closed.");
- }
- });
+// DisplayThreadLoading(e);
}
#endregion
}