diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-12 19:04:09 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-12 19:04:09 +0300 |
| commit | ca50e0c8fc88acd06d6e1932e9412464bff95edb (patch) | |
| tree | aaafb06deca983c1e80c8c34508d23a452e4a235 /Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs | |
| parent | 8a59643571080bfff715f0b0e4bb03e2dee4961a (diff) | |
| download | Tango-ca50e0c8fc88acd06d6e1932e9412464bff95edb.tar.gz Tango-ca50e0c8fc88acd06d6e1932e9412464bff95edb.zip | |
Working on PPC modules and loading.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs index e6c778a92..8ab602f2c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs @@ -12,13 +12,16 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Logging; +using Tango.PPC.Common; +using Tango.PPC.UI.ViewsContracts; namespace Tango.PPC.UI.Views { /// <summary> /// Interaction logic for LayoutView.xaml /// </summary> - public partial class LayoutView : UserControl + public partial class LayoutView : UserControl, ILayoutView { public static LayoutView Instance { get; private set; } @@ -27,5 +30,28 @@ namespace Tango.PPC.UI.Views InitializeComponent(); Instance = this; } + + public void ApplyModules(IEnumerable<IPPCModule> modules) + { + this.BeginInvoke(() => + { + foreach (var module in modules) + { + if (!NavigationControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType)) + { + LogManager.Default.Log("Loading module " + module.Name + "..."); + FrameworkElement view = Activator.CreateInstance(module.MainViewType) as FrameworkElement; + SharedUI.Controls.NavigationControl.SetNavigationName(view, module.Name); + NavigationControl.Elements.Add(view); + module.Initialize(); + } + } + + if (modules.Count() > 0) + { + NavigationControl.NavigateTo(modules.First().Name); + } + }); + } } } |
