diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-08-26 10:55:44 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-08-26 10:55:44 +0300 |
| commit | 6e2fbaffeec9d6e3518ea9706eea107a4f1b348c (patch) | |
| tree | f50b3d8962dd37188061f8f52c1a7aeff1642232 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB | |
| parent | db3dc558ec5fe5f3584081795865cd22f912da7d (diff) | |
| parent | e6704dce7a2b7f6d5f9bbf1b8374cc7f00ea061e (diff) | |
| download | Tango-6e2fbaffeec9d6e3518ea9706eea107a4f1b348c.tar.gz Tango-6e2fbaffeec9d6e3518ea9706eea107a4f1b348c.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB')
4 files changed, 73 insertions, 22 deletions
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..fe6b7a013 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.9.1159")] [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 @@ <OutputType>library</OutputType> <RootNamespace>Tango.MachineStudio.DB</RootNamespace> <AssemblyName>Tango.MachineStudio.DB</AssemblyName> - <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <WarningLevel>4</WarningLevel> 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<DBModule> + 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 @@ <Thumb HorizontalAlignment="Left" Opacity="0" Width="5" VerticalAlignment="Stretch" Cursor="SizeWE" DragDelta="Thumb_DragDelta"></Thumb> </Grid> + + <Grid Background="#C9000000" Visibility="{Binding NotLoaded,Converter={StaticResource BoolToVisConverter}}"> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 20 0 0"> + <TextBlock TextAlignment="Center" FontSize="16" Foreground="Gainsboro"> + <Run>The Database module is considered obsolete and will be removed in the future.</Run> + <LineBreak/> + <Run>Loading the module will require some time and memory.</Run> + </TextBlock> + + <Button Height="50" Width="200" Margin="0 40 0 0" Command="{Binding LoadCommand}">LOAD</Button> + <mahapps:ProgressRing Margin="0 20 0 0" IsActive="{Binding IsLoading}" /> + </StackPanel> + </Grid> </Grid> </UserControl> |
