aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-14 17:32:09 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-14 17:32:09 +0300
commit61a68af94273563e1179b49062ac96b8a627a72a (patch)
treeb435c82b2046ece012b3555afa77c660f0a2b0ca /Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation
parent580cb401e8b31501cb3fbee1b9f59a67ad636633 (diff)
downloadTango-61a68af94273563e1179b49062ac96b8a627a72a.tar.gz
Tango-61a68af94273563e1179b49062ac96b8a627a72a.zip
Working on PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs27
1 files changed, 22 insertions, 5 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 82640f899..ae1d29bc2 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -41,6 +42,12 @@ namespace Tango.PPC.UI.Navigation
MainView.Instance.NavigationControl.NavigateTo(NavigationView.LayoutView.ToString());
var firstModule = _moduleLoader.UserModules.FirstOrDefault();
LayoutView.Instance.NavigationControl.NavigateTo(firstModule.Name);
+ var moduleAtt = firstModule.GetType().GetCustomAttribute<PPCModuleAttribute>();
+
+ if (moduleAtt != null)
+ {
+ NavigateTo(firstModule.GetType(), moduleAtt.HomeViewName);
+ }
}
else
{
@@ -88,16 +95,26 @@ namespace Tango.PPC.UI.Navigation
/// <param name="viewPath">The view path.</param>
public void NavigateTo<T>(params String[] viewPath) where T : IPPCModule
{
+ NavigateTo(typeof(T), viewPath);
+ }
+
+ /// <summary>
+ /// Navigates to the specified module using the view path (e.g MainView,JobsView).
+ /// This method makes it easy to do stuff like NavigateTo(nameof(MainView),nameof(JobsView));
+ /// </summary>
+ /// <param name="viewPath">The view path.</param>
+ private void NavigateTo(Type moduleType, params String[] viewPath)
+ {
MainView.Instance.NavigationControl.NavigateTo(NavigationView.LayoutView.ToString());
var navigationControl = LayoutView.Instance.NavigationControl;
- var module = _moduleLoader.UserModules.SingleOrDefault(x => x.GetType() == typeof(T));
+ var module = _moduleLoader.UserModules.SingleOrDefault(x => x.GetType() == moduleType);
var moduleView = navigationControl.NavigateTo(module.Name);
var moduleNavigation = moduleView.FindChildOffline<NavigationControl>();
- foreach (var view in viewPath)
+ moduleNavigation.RegisterForLoadedOrNow(async (x, e) =>
{
- moduleNavigation.RegisterForLoadedOrNow(async (x, e) =>
+ foreach (var view in viewPath)
{
await Task.Delay(100);
var v = moduleNavigation.NavigateTo(view);
@@ -106,8 +123,8 @@ namespace Tango.PPC.UI.Navigation
{
moduleNavigation = v.FindChildOffline<NavigationControl>();
}
- });
- }
+ }
+ });
}
}
}