diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs | 31 |
1 files changed, 17 insertions, 14 deletions
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 befad6000..9e51d7252 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -64,7 +64,7 @@ namespace Tango.PPC.UI.Navigation /// Navigates to the specified PPC view. /// </summary> /// <param name="view">The view.</param> - public Task<bool> NavigateTo(NavigationView view) + public Task<bool> NavigateTo(NavigationView view, bool pushToHistory = true) { if (view == NavigationView.HomeModule) { @@ -75,11 +75,11 @@ namespace Tango.PPC.UI.Navigation if (moduleAtt != null) { - return NavigateTo(firstModule.GetType(), moduleAtt.HomeViewName); + return NavigateTo(firstModule.GetType(), pushToHistory, moduleAtt.HomeViewName); } else { - return NavigateTo(firstModule.GetType()); + return NavigateTo(firstModule.GetType(), pushToHistory); } } else @@ -93,7 +93,7 @@ namespace Tango.PPC.UI.Navigation /// Navigates to the specified module. /// </summary> /// <typeparam name="T"></typeparam> - public Task<bool> NavigateTo<T>() where T : IPPCModule + public Task<bool> NavigateTo<T>(bool pushToHistory = true) where T : IPPCModule { return NavigateTo(typeof(T)); } @@ -103,9 +103,9 @@ namespace Tango.PPC.UI.Navigation /// </summary> /// <typeparam name="T"></typeparam> /// <param name="viewPath">The view path.</param> - public Task<bool> NavigateTo<T>(string viewPath) where T : IPPCModule + public Task<bool> NavigateTo<T>(string viewPath, bool pushToHistory = true) where T : IPPCModule { - return NavigateTo<T>(viewPath.Split('.')); + return NavigateTo<T>(pushToHistory, viewPath.Split('.')); } /// <summary> @@ -114,16 +114,16 @@ namespace Tango.PPC.UI.Navigation /// </summary> /// <typeparam name="T"></typeparam> /// <param name="viewPath">The view path.</param> - public Task<bool> NavigateTo<T>(params String[] viewPath) where T : IPPCModule + public Task<bool> NavigateTo<T>(bool pushToHistory = true, params String[] viewPath) where T : IPPCModule { - return NavigateTo(typeof(T), viewPath); + return NavigateTo(typeof(T), pushToHistory, viewPath); } /// <summary> /// Navigates to the specified module and view by full path (e.g Jobs.JobsView). /// </summary> /// <param name="fullPath">The full path.</param> - public async Task<bool> NavigateTo(String fullPath) + public async Task<bool> NavigateTo(String fullPath, bool pushToHistory = true) { String[] path = fullPath.Split('.'); var module = _moduleLoader.UserModules.SingleOrDefault(x => x.GetType().Name == path[0] || x.Name == path[0]); @@ -138,8 +138,11 @@ namespace Tango.PPC.UI.Navigation } } - _navigationHistory.Push(fullPath); - RaisePropertyChanged(nameof(CanNavigateBack)); + if (pushToHistory) + { + _navigationHistory.Push(fullPath); + RaisePropertyChanged(nameof(CanNavigateBack)); + } MainView.Instance.NavigationControl.NavigateTo(NavigationView.LayoutView.ToString()); var navigationControl = LayoutView.Instance.NavigationControl; @@ -172,15 +175,15 @@ namespace Tango.PPC.UI.Navigation return true; } - private Task<bool> NavigateTo(Type moduleType, params String[] viewPath) + private Task<bool> NavigateTo(Type moduleType, bool pushToHistory = true, params String[] viewPath) { if (viewPath != null && viewPath.Length > 0) { - return NavigateTo(moduleType.Name + "." + String.Join(".", viewPath)); + return NavigateTo(moduleType.Name + "." + String.Join(".", viewPath), pushToHistory); } else { - return NavigateTo(moduleType.Name); + return NavigateTo(moduleType.Name, pushToHistory); } } |
