diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-09-16 09:01:54 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-09-16 09:01:54 +0300 |
| commit | 8d1ada2f7652423c8894cb65ec347f5a04f61682 (patch) | |
| tree | 47c845299345a6302c47632d9977e3ba5ab6c486 /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels | |
| parent | 97ce3a3c2fb5e4d913a5f3424dabacc7dab1e819 (diff) | |
| parent | 4e8140f7712961e35b45a47269461f53ae6031ec (diff) | |
| download | Tango-8d1ada2f7652423c8894cb65ec347f5a04f61682.tar.gz Tango-8d1ada2f7652423c8894cb65ec347f5a04f61682.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 97 |
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 } |
