aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-02 16:27:32 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-02 16:27:32 +0300
commitd866652d38d2366c333a1ff5092aff1cc4b85dfa (patch)
tree0e004697f3971d03ecfb71dc7d0caf8aec6d01e3 /Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation
parent58f612e03a9bb31c2ada4eb3c5989be458ec4ff5 (diff)
downloadTango-d866652d38d2366c333a1ff5092aff1cc4b85dfa.tar.gz
Tango-d866652d38d2366c333a1ff5092aff1cc4b85dfa.zip
Implemented Twine's catalog control, Twine's catalog viewer, Twines catalog color correction view.
Added INavigationResultProvider OnNavigationObjectReceived method.. Improved navigation system history.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs33
1 files changed, 23 insertions, 10 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 c56e0f000..d26f4d396 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
@@ -26,6 +26,8 @@ namespace Tango.PPC.UI.Navigation
private IPPCModuleLoader _moduleLoader;
private Object _currentVM;
+ private String _lastFullPath;
+ private bool _preventHistory;
private Stack<String> _navigationHistory;
@@ -71,6 +73,7 @@ namespace Tango.PPC.UI.Navigation
if (view == NavigationView.HomeModule)
{
_navigationHistory.Clear();
+ _lastFullPath = null;
var firstModule = _moduleLoader.UserModules.FirstOrDefault();
var moduleAtt = firstModule.GetType().GetCustomAttribute<PPCModuleAttribute>();
@@ -142,12 +145,14 @@ namespace Tango.PPC.UI.Navigation
}
}
- if (pushToHistory)
+ if (pushToHistory && _lastFullPath != null && !_preventHistory)
{
- _navigationHistory.Push(fullPath);
+ _navigationHistory.Push(_lastFullPath);
RaisePropertyChanged(nameof(CanNavigateBack));
}
+ _lastFullPath = fullPath;
+
MainView.Instance.NavigationControl.NavigateTo(NavigationView.LayoutView.ToString());
var navigationControl = LayoutView.Instance.NavigationControl;
CurrentModule = module;
@@ -193,7 +198,7 @@ namespace Tango.PPC.UI.Navigation
}
}
- public Task<TResult> NavigateForResult<TModule, TView, TResult>(bool pushToHistory = true)
+ public Task<TResult> NavigateForResult<TModule, TView, TResult, TObject>(TObject obj, bool pushToHistory = true)
where TModule : IPPCModule
{
TaskCompletionSource<TResult> source = new TaskCompletionSource<TResult>();
@@ -204,19 +209,23 @@ namespace Tango.PPC.UI.Navigation
Action<Object, Object> handler = null;
- handler = (from, to) =>
+ handler = (from, to) =>
{
if (toVM == null)
{
toVM = to;
+ if (toVM is INavigationResultProvider<TResult, TObject>)
+ {
+ (toVM as INavigationResultProvider<TResult, TObject>).OnNavigationObjectReceived(obj);
+ }
}
else
{
if (to == fromVM && from == toVM)
{
- if (from is INavigationResultProvider<TResult>)
+ if (from is INavigationResultProvider<TResult, TObject>)
{
- source.SetResult((from as INavigationResultProvider<TResult>).GetNavigationResult());
+ source.SetResult((from as INavigationResultProvider<TResult, TObject>).GetNavigationResult());
}
}
@@ -236,7 +245,7 @@ namespace Tango.PPC.UI.Navigation
/// </summary>
public bool CanNavigateBack
{
- get { return _navigationHistory.Count > 1; }
+ get { return _navigationHistory.Count > 0; }
}
/// <summary>
@@ -245,16 +254,20 @@ namespace Tango.PPC.UI.Navigation
public async Task<bool> NavigateBack()
{
String first = _navigationHistory.Pop();
- String second = _navigationHistory.Pop();
+ _preventHistory = true;
- if (await NavigateTo(second))
+
+ if (await NavigateTo(first))
{
+ RaisePropertyChanged(nameof(CanNavigateBack));
+ _preventHistory = false;
return true;
}
else
{
- _navigationHistory.Push(second);
_navigationHistory.Push(first);
+ _preventHistory = false;
+ RaisePropertyChanged(nameof(CanNavigateBack));
return false;
}
}