diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-11-21 12:14:55 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-11-21 12:14:55 +0200 |
| commit | 8de9762343d53469f493e5ead81e37d575f3f6d9 (patch) | |
| tree | 38bc8f29ada92081a2267c4fa0ef147f0e8df784 /Software | |
| parent | 94c88e6e337be52b77ce3debf56ca09e7d80b2b6 (diff) | |
| download | Tango-8de9762343d53469f493e5ead81e37d575f3f6d9.tar.gz Tango-8de9762343d53469f493e5ead81e37d575f3f6d9.zip | |
Refactored PPC Navigation "OnNavigatedFrom/To" to be called from the navigation manager instead of NavigationControl.
Fixed issue with PPC job progress app bar item not visible in some cases.
Diffstat (limited to 'Software')
3 files changed, 31 insertions, 3 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index e49be7166..1de54b784 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -164,7 +164,7 @@ namespace Tango.PPC.Jobs.ViewModels NotificationProvider.CurrentAppBarItem.Close(); } - if (!_handler.Status.IsFailed) + if (_handler != null && !_handler.Status.IsFailed) { _stop_job_btn.Push(); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs index 5e584f891..5cf6d7817 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs @@ -27,7 +27,7 @@ namespace Tango.PPC.Common /// Represents a PPC view model base class. /// </summary> /// <seealso cref="Tango.SharedUI.ViewModel" /> - public abstract class PPCViewModel : ViewModel, INavigationViewModel, INavigationBlocker + public abstract class PPCViewModel : ViewModel, INavigationBlocker { /// <summary> /// Gets the static observable entities adapter. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs index fe3cabcc1..a0338912f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -202,6 +202,8 @@ namespace Tango.PPC.UI.Navigation } } + + if (pushToHistory && _lastFullPath != null && !_preventHistory) { _navigationHistory.Push(_lastFullPath); @@ -228,7 +230,19 @@ namespace Tango.PPC.UI.Navigation foreach (var view in path.Skip(1)) { await Task.Delay(100); - var v = moduleNavigation.NavigateTo(view); + + var v = moduleNavigation.NavigateTo(view, () => + { + if (fromVM is PPCViewModel) + { + (fromVM as PPCViewModel)?.OnNavigatedFrom(); + } + + if (_currentVM is PPCViewModel) + { + (_currentVM as PPCViewModel)?.OnNavigatedTo(); + } + }); if (v != null) { @@ -253,6 +267,20 @@ namespace Tango.PPC.UI.Navigation NavigationCycleCompleted?.Invoke(fromVM, _currentVM); } } + else + { + await Task.Delay(500); + + if (fromVM is PPCViewModel) + { + (fromVM as PPCViewModel)?.OnNavigatedFrom(); + } + + if (_currentVM is PPCViewModel) + { + (_currentVM as PPCViewModel)?.OnNavigatedTo(); + } + } return true; } |
