diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-04-21 19:49:05 +0300 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-04-21 19:49:05 +0300 |
| commit | 0dec8a74239cff769836cae577fbd84824070e83 (patch) | |
| tree | d6cc24ee53454b3f17f1580e90de38238555b6bd /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs | |
| parent | 4df1724226c0d0941b970dbe71b1476e3c3e9902 (diff) | |
| download | Tango-0dec8a74239cff769836cae577fbd84824070e83.tar.gz Tango-0dec8a74239cff769836cae577fbd84824070e83.zip | |
Implemented NavigationControl for better performance!!!
Redesign of machine studio module initialization.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs index 442d11cdd..df1f97f23 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs @@ -26,6 +26,7 @@ using System.Threading; using Tango.Core.Helpers; using Tango.SharedUI.Helpers; using Tango.Logging; +using static Tango.SharedUI.Controls.NavigationControl; namespace Tango.MachineStudio.UI.Views { @@ -44,15 +45,8 @@ namespace Tango.MachineStudio.UI.Views _loader.ModulesLoaded += Loader_ModulesLoaded; } - public void NavigateToModule(IStudioModule module) - { - TransitionControl.AutoNavigate(module != null ? module.Name : "Home"); - } - private void Loader_ModulesLoaded(object sender, EventArgs e) { - TransitionControl.Controls.RemoveAll((x) => x.Tag.ToString() != "Home"); - Task.Factory.StartNew(() => { LogManager.Default.Log("Loading modules views..."); @@ -74,15 +68,12 @@ namespace Tango.MachineStudio.UI.Views ThreadsHelper.InvokeUI(() => { - Grid grid = new Grid(); - grid.Children.Add(module.MainView); - - TransitionControl.Controls.Add(new ContentControl() + if (!TransitionControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType)) { - Tag = module.Name, - Content = grid, - Visibility = Visibility.Hidden, - }); + FrameworkElement view = Activator.CreateInstance(module.MainViewType) as FrameworkElement; + NavigationControl.SetNavigationName(view, module.Name); + TransitionControl.Elements.Add(view); + } _loader.UserModules.Add(module); }); @@ -92,11 +83,6 @@ namespace Tango.MachineStudio.UI.Views Thread.Sleep(100); } - ThreadsHelper.InvokeUI(() => - { - TransitionControl.RefreshControls(); - }); - item.Pop(); }); } |
