From 8de9762343d53469f493e5ead81e37d575f3f6d9 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 21 Nov 2019 12:14:55 +0200 Subject: 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. --- .../Navigation/DefaultNavigationManager.cs | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation') 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; } -- cgit v1.3.1