From 4e81425d99f39b8edc10660d72566c6c1408810d Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 23 Aug 2018 14:52:22 +0300 Subject: changes on other computers --- .../Properties/AssemblyInfo.cs | 2 +- .../Tango.MachineStudio.DB.csproj | 2 +- .../ViewModels/MainViewVM.cs | 77 ++++++++++++++++------ .../Tango.MachineStudio.DB/Views/MainDBView.xaml | 14 ++++ 4 files changed, 73 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Properties/AssemblyInfo.cs index 3b589e28b..212d21202 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Machine Studio DB Module")] -[assembly: AssemblyVersion("2.0.7.1633")] +[assembly: AssemblyVersion("2.0.8.1119")] [assembly: ComVisible(false)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj index 393c4e491..259f2f652 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj @@ -8,7 +8,7 @@ library Tango.MachineStudio.DB Tango.MachineStudio.DB - v4.6 + v4.7.2 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs index 727436306..9503e4c38 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using System.Windows; using Tango.BL; using Tango.BL.Entities; +using Tango.Core.Commands; using Tango.Core.DI; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.StudioApplication; @@ -14,36 +15,72 @@ using Tango.SharedUI; namespace Tango.MachineStudio.DB.ViewModels { - public class MainViewVM : StudioViewModel + public class MainViewVM : StudioViewModel { - public MainViewVM() : base() + private bool _isLoading; + public bool IsLoading { + get { return _isLoading; } + set { _isLoading = value; RaisePropertyChangedAuto(); } + } + private bool _notLoaded; + public bool NotLoaded + { + get { return _notLoaded; } + set { _notLoaded = value; RaisePropertyChangedAuto(); } } - public override void OnModuleRequest(params object[] args) + public RelayCommand LoadCommand { get; set; } + + public MainViewVM() : base() { - if (args != null && args.Length > 0 && args[0] is IObservableEntity) - { - var arg = args[0]; + NotLoaded = true; + LoadCommand = new RelayCommand(LoadAdapter,() => !IsLoading); + } - String vmName = arg.GetType().Name + "sViewVM"; + private async void LoadAdapter() + { + IsLoading = true; + InvalidateRelayCommands(); - Type vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName); + await Task.Factory.StartNew(() => + { + ObservablesEntitiesAdapter.Instance.Initialize(); + }); - if (vmType == null) - { - vmName = arg.GetType().BaseType.Name + "sViewVM"; - vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName); - } + IsLoading = false; + NotLoaded = false; + } - if (vmType != null) - { - var vm = TangoIOC.Default.GetInstance(vmType); - vmType.GetProperty("SelectedEntity").SetValue(vm, arg); - vmType.GetMethod("OnEdit", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(vm, new object[] { }); - } - } + public override void OnApplicationReady() + { + } + + //public override void OnModuleRequest(params object[] args) + //{ + // if (args != null && args.Length > 0 && args[0] is IObservableEntity) + // { + // var arg = args[0]; + + // String vmName = arg.GetType().Name + "sViewVM"; + + // Type vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName); + + // if (vmType == null) + // { + // vmName = arg.GetType().BaseType.Name + "sViewVM"; + // vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName); + // } + + // if (vmType != null) + // { + // var vm = TangoIOC.Default.GetInstance(vmType); + // vmType.GetProperty("SelectedEntity").SetValue(vm, arg); + // vmType.GetMethod("OnEdit", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(vm, new object[] { }); + // } + // } + //} } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml index a6edd80da..050ce5f31 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml @@ -6,6 +6,7 @@ xmlns:dockablz="clr-namespace:Dragablz.Dockablz;assembly=Dragablz" xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:managers="clr-namespace:Tango.MachineStudio.DB.Managers" @@ -154,5 +155,18 @@ + + + + + The Database module is considered obsolete and will be removed in the future. + + Loading the module will require some time and memory. + + + + + + -- cgit v1.3.1