diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-13 16:12:45 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-13 16:12:45 +0300 |
| commit | 998cc8d4d91a7f85389cd0918f127257576c2c13 (patch) | |
| tree | 368ecd76f09b8ff1c4156a554b799cd231c42119 /Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs | |
| parent | 4490b0a76d4188cb285d62b106e208803ceaa133 (diff) | |
| download | Tango-998cc8d4d91a7f85389cd0918f127257576c2c13.tar.gz Tango-998cc8d4d91a7f85389cd0918f127257576c2c13.zip | |
Logs and comments for PPC.UI !
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 | 19 |
1 files changed, 17 insertions, 2 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 a05d5fc5c..eee37b2e0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -102,6 +103,8 @@ namespace Tango.PPC.UI.Navigation } else { + + LogManager.Log($"Navigating to: {view.ToString()}..."); MainView.Instance.NavigationControl.NavigateTo(view.ToString()); return Task.FromResult(true); } @@ -116,8 +119,9 @@ namespace Tango.PPC.UI.Navigation /// <returns></returns> public Task<bool> NavigateWithObject<TPass>(NavigationView view, TPass obj, bool pushToHistory = true) { + LogManager.Log($"Navigating to: {view.ToString()}, with object {typeof(TPass).Name}..."); MainView.Instance.NavigationControl.NavigateTo(view.ToString()); - INavigationObjectReceiver<TPass> receiver = MainView.Instance.NavigationControl.Elements.FirstOrDefault(x => (x.GetType().Name == view.ToString() || NavigationControl.GetNavigationName(x) == view.ToString()) && x.DataContext is INavigationObjectReceiver<TPass>).DataContext as INavigationObjectReceiver<TPass>; + INavigationObjectReceiver<TPass> receiver = MainView.Instance.NavigationControl.Elements.FirstOrDefault(x => (x.GetType().Name == view.ToString() || NavigationControl.GetNavigationName(x) == view.ToString()) && x.DataContext is INavigationObjectReceiver<TPass>).DataContext as INavigationObjectReceiver<TPass>; if (receiver != null) { @@ -168,6 +172,8 @@ namespace Tango.PPC.UI.Navigation if (path.Length == 1 && path[0] == CurrentModule.Name) return true; + LogManager.Log($"Navigating to: {fullPath}..."); + var fromVM = _currentVM; if (_currentVM != null && _currentVM is INavigationBlocker) @@ -225,7 +231,7 @@ namespace Tango.PPC.UI.Navigation } else { - throw new ArgumentNullException("Could not navigate to " + fullPath); + throw LogManager.Log(new ArgumentNullException("Could not navigate to " + fullPath)); } } @@ -345,6 +351,8 @@ namespace Tango.PPC.UI.Navigation /// </summary> public async Task<bool> NavigateBack() { + LogManager.Log("Navigating back..."); + _navigating_back = true; String first = _navigationHistory.Pop(); @@ -373,12 +381,19 @@ namespace Tango.PPC.UI.Navigation /// </summary> public void ClearHistory() { + LogManager.Log("Navigation history cleared."); _navigationHistory.Clear(); RaisePropertyChanged(nameof(CanNavigateBack)); } + /// <summary> + /// Clears the navigation back history except the specified view type. + /// </summary> + /// <typeparam name="T"></typeparam> public void ClearHistoryExcept<T>() { + LogManager.Log($"Navigation history cleared except for {typeof(T).Name}."); + var history_list = _navigationHistory.ToList(); history_list = history_list.Where(x => x.Contains(typeof(T).Name)).Distinct().ToList(); _navigationHistory.Clear(); |
