From 3234e33cc4ba354f0395bb514b8b2fa102cf38ec Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 21 Jan 2018 15:56:57 +0200 Subject: Started working on Developer module. --- .../Views/MachineView.xaml | 327 +++++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml new file mode 100644 index 000000000..a54f9bbdc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hardware + + + + + + Add IDS + + + + + + Remove IDS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NO IDS PACKS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Touch Panel + + + + + + Embedded Firmware + + + + + + Dispensers + + + + + + Mid Tanks + + + + + + Cartridges + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.3.1 From d71c73171948d29db6dab71e1ca038445d6ab318 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 22 Jan 2018 17:12:18 +0200 Subject: Implemented Developer Module Configuration Section! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../ViewModels/MainViewVM.cs | 26 +- .../Tango.MachineStudio.DB/Views/MainDBView.xaml | 3 +- .../ViewModels/MainViewVM.cs | 65 ++- .../Views/MainView.xaml | 448 +++++++++++++++++---- .../Views/MachineView.xaml | 2 +- .../Tango.MachineStudio.UI/MainWindow.xaml | 6 +- .../ICSharpCode.AvalonEdit.csproj | 16 +- .../Tango.Integration/Printing/Profile.cs | 22 + .../Tango.Integration/Printing/Segment.cs | 14 + .../Tango.Integration/Tango.Integration.csproj | 2 + .../Visual_Studio/Tango.SharedUI/Shapes/Hexagon.cs | 30 ++ .../Tango.SharedUI/Tango.SharedUI.csproj | 1 + Software/Visual_Studio/Tango.sln | 4 +- 15 files changed, 543 insertions(+), 96 deletions(-) create mode 100644 Software/Visual_Studio/Tango.Integration/Printing/Profile.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Printing/Segment.cs create mode 100644 Software/Visual_Studio/Tango.SharedUI/Shapes/Hexagon.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 0190a6686..637f713f5 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index eb56d926e..b111bb6d7 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ 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 a0ce93a5a..7e472ee75 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 @@ -1,18 +1,40 @@ -using System; +using Microsoft.Practices.ServiceLocation; +using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.StudioApplication; using Tango.SharedUI; namespace Tango.MachineStudio.DB.ViewModels { - public class MainViewVM : ViewModel + public class MainViewVM : ViewModel, IModuleRequestListener { public MainViewVM() : base() { } + + public void OnRequestModule(IStudioModule module, object args) + { + if (module is DBModule && args != null && args is IObservableEntity) + { + String vmName = args.GetType().Name + "sViewVM"; + + Type vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName); + + if (vmType != null) + { + var vm = ServiceLocator.Current.GetInstance(vmType); + vmType.GetProperty("SelectedEntity").SetValue(vm, args); + 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 6c7cb2b95..a6edd80da 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 @@ -9,10 +9,11 @@ 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" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1270" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="720" d:DesignWidth="1270" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index e7e97097b..621ce550b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1,5 +1,7 @@ -using System; +using GalaSoft.MvvmLight.Ioc; +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -21,29 +23,86 @@ namespace Tango.MachineStudio.Developer.ViewModels public Machine SelectedMachine { get { return _selectedMachine; } - set { _selectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + set { _selectedMachine = value; RaisePropertyChangedAuto(); OnMachineChanged(); InvalidateRelayCommands(); } } + private List _liquidTypesRmls; + + public List LiquidTypesRmls + { + get { return _liquidTypesRmls; } + set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _rmlProcessParametersTables; + + public ObservableCollection RmlProcessParametersTables + { + get { return _rmlProcessParametersTables; } + set { _rmlProcessParametersTables = value; RaisePropertyChangedAuto(); } + } + + private DBViewContextWrapper _selectedRML; public DBViewContextWrapper SelectedRML { get { return _selectedRML; } - set { _selectedRML = value; RaisePropertyChangedAuto(); } + set { _selectedRML = value; RaisePropertyChangedAuto(); InvalidateLiquidFactorsAndProcessTables(); InvalidateRelayCommands(); } } + private bool _isSideBarOpened; + + public bool IsSideBarOpened + { + get { return _isSideBarOpened; } + set { _isSideBarOpened = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand EditMachineCommand { get; set; } + public RelayCommand EditRMLCommand { get; set; } + + public RelayCommand ToggleSideBarCommand { get; set; } + + public MainViewVM() + { + IsSideBarOpened = true; + } + + [PreferredConstructor] public MainViewVM(IStudioApplicationManager applicationManager) { Adapter = ObservablesEntitiesAdapter.Instance; EditMachineCommand = new RelayCommand(EditMachine, (x) => SelectedMachine != null); ApplicationManager = applicationManager; + EditRMLCommand = new RelayCommand(EditRML, (x) => SelectedRML != null); + ToggleSideBarCommand = new RelayCommand(() => IsSideBarOpened = !IsSideBarOpened); + } + + private void EditRML() + { + ApplicationManager.RequestModule("Data Base", SelectedRML.EditEntity); } private void EditMachine() { ApplicationManager.RequestModule("Machine Designer", SelectedMachine); } + + private void OnMachineChanged() + { + InvalidateLiquidFactorsAndProcessTables(); + } + + private void InvalidateLiquidFactorsAndProcessTables() + { + if (SelectedRML != null && SelectedMachine != null) + { + LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidTypes).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.EditEntity.Guid).ToList(); + RmlProcessParametersTables = SelectedRML.EditEntity.RmlsProcessParametersTables.ToObservableCollection(); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 5b26b7891..0a65511c8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -12,9 +12,11 @@ xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" xmlns:localConverters="clr-namespace:Tango.MachineStudio.Developer.Converters" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:observables="clr-namespace:Tango.DAL.Observables;assembly=Tango.DAL.Observables" + xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" Background="White" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + d:DesignHeight="1080" d:DesignWidth="1280" Background="White" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=True}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + - - + + + Dyeing Speed: + + + - - + + + Min Ink Uptake: + + + - + + + Dryer Zone3 Temp: + + + + + + + + Dryer Air Flow: + + + + + + + Winder Tension: + + + + + + + Lubrication NL/CM: + + + + + + + Lubrication: + + + + + + + + + + + + + + + + + SELECT MACHINE & MEDIA + + + + + + + + - + + + + + + LIQUID FACTORS ( Max Nanolitter/CM ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT MACHINE & MEDIA + + + + + + + + - + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml index a54f9bbdc..a7e604352 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -13,7 +13,7 @@ xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" Background="White" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}"> + d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml index 83f41b785..af3715a40 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml @@ -11,8 +11,8 @@ Title="Tango" Height="800" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}"> - - + + @@ -34,6 +34,6 @@ - + diff --git a/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj b/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj index 3229f6f21..abf0d23a2 100644 --- a/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj +++ b/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj @@ -1,5 +1,5 @@  - + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} Debug @@ -7,7 +7,7 @@ Library ICSharpCode.AvalonEdit ICSharpCode.AvalonEdit - v4.0 + v4.6 Properties "C:\Program Files\SharpDevelop\3.0\bin\..\AddIns\AddIns\Misc\SourceAnalysis\Settings.SourceAnalysis" False @@ -23,7 +23,8 @@ ..\bin\$(Configuration) ..\bin\$(Configuration)\ICSharpCode.AvalonEdit.xml 1607 - Client + + SAK SAK SAK @@ -52,7 +53,14 @@ bin\Debug\ - bin\Debug\ICSharpCode.AvalonEdit.xml + + + false + + + false + bin\Release\ + diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Profile.cs b/Software/Visual_Studio/Tango.Integration/Printing/Profile.cs new file mode 100644 index 000000000..9eccfcdcc --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Printing/Profile.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.Integration.Printing +{ + public class Profile : ExtendedObject + { + private String _name; + + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); } + } + + + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs b/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs new file mode 100644 index 000000000..0854485e5 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.Integration.Printing +{ + public class Segment : ExtendedObject + { + + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 1963f9ce3..4257dd53e 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -67,6 +67,8 @@ + + diff --git a/Software/Visual_Studio/Tango.SharedUI/Shapes/Hexagon.cs b/Software/Visual_Studio/Tango.SharedUI/Shapes/Hexagon.cs new file mode 100644 index 000000000..ce256e9b7 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Shapes/Hexagon.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; +using System.Windows.Shapes; + +namespace Tango.SharedUI.Shapes +{ + public class Hexagon : Shape + { + public Hexagon() : base() + { + this.Stretch = System.Windows.Media.Stretch.Fill; + } + protected override Geometry DefiningGeometry + { + get { return GetGeometry(); } + } + + private Geometry GetGeometry() + { + double sideLength = 100; + double x = Math.Sqrt(sideLength * sideLength / 2); + return Geometry.Parse(String.Format("M {0},0 h {1} l {0},{0} l -{0},{0} h -{1} l -{0},-{0} Z", x, sideLength)); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index 47464cfc8..623cda176 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -118,6 +118,7 @@ Settings.settings True + ResXFileCodeGenerator diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index ecfa6d34d..d16c26a38 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -882,8 +882,8 @@ Global {FC0FB4A1-360E-42B1-8372-9208A3098B2A}.Release|x64.Build.0 = Release|Any CPU {FC0FB4A1-360E-42B1-8372-9208A3098B2A}.Release|x86.ActiveCfg = Release|Any CPU {FC0FB4A1-360E-42B1-8372-9208A3098B2A}.Release|x86.Build.0 = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Release|Any CPU + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Release|Any CPU {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|ARM.ActiveCfg = Debug|Any CPU {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|ARM.Build.0 = Debug|Any CPU {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|ARM64.ActiveCfg = Debug|Any CPU -- cgit v1.3.1 From 20482140c124fd1d5caaffcc9b0dfe853b30dd6f Mon Sep 17 00:00:00 2001 From: Roy Date: Sat, 27 Jan 2018 17:18:10 +0200 Subject: Re-factored DAL Observables using EF Code First !!!!!! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../EventTypeActionsToStringConverter.cs | 2 +- .../Managers/RegisteredView.cs | 2 + .../ViewModels/EventTypesViewVM.cs | 16 +- .../ViewModels/LiquidTypesViewVM.cs | 12 +- .../ViewModels/RolesViewVM.cs | 10 +- .../ViewModels/UsersViewVM.cs | 27 +- .../Views/DBViews/CatView.xaml | 2 +- .../Views/DBViews/CatsView.xaml | 4 +- .../Views/DBViews/ConfigurationView.xaml | 14 +- .../Views/DBViews/ConfigurationsView.xaml | 14 +- .../Views/DBViews/IdsPackView.xaml | 8 +- .../Views/DBViews/IdsPacksView.xaml | 10 +- .../Views/DBViews/LiquidTypesRmlView.xaml | 2 +- .../Views/DBViews/LiquidTypesRmlsView.xaml | 4 +- .../Views/DBViews/MachineVersionView.xaml | 2 +- .../Views/DBViews/MachineVersionsView.xaml | 2 +- .../Views/DBViews/MachineView.xaml | 2 +- .../Views/DBViews/MachinesView.xaml | 2 +- .../Views/DBViews/ProcessParametersTableView.xaml | 2 +- .../Views/DBViews/ProcessParametersTablesView.xaml | 2 +- .../Views/DBViews/RmlView.xaml | 14 +- .../Views/DBViews/RmlsView.xaml | 14 +- .../ViewModels/MainViewVM.cs | 40 +- .../Views/MainView.xaml | 10 +- .../ViewModels/MainViewVM.cs | 58 +-- .../Views/MachineView.xaml | 40 +- .../Views/MainView.xaml | 48 +-- .../Tango.MachineStudio.UI/MainWindow.xaml | 42 +- .../Tango.CodeGeneration/EntityCodeFile.cs | 6 + .../ObservablesContextCodeFile.cs | 12 + .../Tango.CodeGeneration.csproj | 2 + .../Templates/EntityCodeFile.cshtml | 37 +- .../Templates/ObservablesContextCodeFile.cshtml | 60 +++ .../Tango.DAL.Observables/Entities/ActionType.cs | 43 +- .../Tango.DAL.Observables/Entities/Address.cs | 72 ++-- .../Entities/ApplicationDisplayPanelVersion.cs | 38 +- .../Entities/ApplicationFirmwareVersion.cs | 38 +- .../Entities/ApplicationOsVersion.cs | 38 +- .../Entities/ApplicationVersion.cs | 38 +- .../Tango.DAL.Observables/Entities/BrushStop.cs | 107 +++-- .../Entities/CartridgeType.cs | 38 +- .../Tango.DAL.Observables/Entities/Cat.cs | 58 ++- .../Tango.DAL.Observables/Entities/Cct.cs | 68 ++-- .../Tango.DAL.Observables/Entities/ColorSpace.cs | 43 +- .../Entities/Configuration.cs | 155 ++++--- .../Tango.DAL.Observables/Entities/Contact.cs | 67 ++- .../Entities/DispenserType.cs | 48 +-- .../Entities/EmbeddedFirmwareVersion.cs | 38 +- .../Entities/EmbeddedSoftwareVersion.cs | 38 +- .../Tango.DAL.Observables/Entities/EventType.cs | 47 +-- .../Entities/EventTypesAction.cs | 54 +-- .../Tango.DAL.Observables/Entities/FiberShape.cs | 38 +- .../Tango.DAL.Observables/Entities/FiberSynth.cs | 38 +- .../Entities/HardwareVersion.cs | 38 +- .../Tango.DAL.Observables/Entities/IdsPack.cs | 103 +++-- .../Tango.DAL.Observables/Entities/Job.cs | 95 ++--- .../Tango.DAL.Observables/Entities/JobRun.cs | 48 +-- .../Entities/LinearMassDensityUnit.cs | 38 +- .../Tango.DAL.Observables/Entities/LiquidType.cs | 56 +-- .../Entities/LiquidTypesRml.cs | 53 +-- .../Tango.DAL.Observables/Entities/Machine.cs | 84 ++-- .../Entities/MachineVersion.cs | 53 +-- .../Entities/MachinesConfiguration.cs | 42 +- .../Entities/MachinesEvent.cs | 67 ++- .../Tango.DAL.Observables/Entities/MediaColor.cs | 33 +- .../Entities/MediaCondition.cs | 38 +- .../Entities/MediaMaterial.cs | 38 +- .../Tango.DAL.Observables/Entities/MediaPurpos.cs | 38 +- .../Tango.DAL.Observables/Entities/MidTankType.cs | 43 +- .../Tango.DAL.Observables/Entities/Organization.cs | 55 +-- .../Tango.DAL.Observables/Entities/Permission.cs | 43 +- .../Entities/ProcessParametersTable.cs | 124 +++--- .../Entities/ProcessParametersTablesGroup.cs | 52 +-- .../Tango.DAL.Observables/Entities/Rml.cs | 246 +++++------ .../Tango.DAL.Observables/Entities/Role.cs | 47 +-- .../Entities/RolesPermission.cs | 42 +- .../Tango.DAL.Observables/Entities/Segment.cs | 47 +-- .../Tango.DAL.Observables/Entities/Sensor.cs | 69 ++-- .../Entities/SyncConfiguration.cs | 24 +- .../Tango.DAL.Observables/Entities/User.cs | 74 ++-- .../Tango.DAL.Observables/Entities/UsersRole.cs | 47 +-- .../Entities/WindingMethod.cs | 43 +- .../Tango.DAL.Observables/ExtensionMethods.cs | 5 +- .../ExtensionMethods/ConfigurationExtensions.cs | 6 +- .../ExtensionMethods/ObservableEntityExtensions.cs | 2 +- .../ProcessParametersTablesGroupExtensions.cs | 2 +- .../Tango.DAL.Observables/IObservableEntity.cs | 25 +- .../Tango.DAL.Observables/ObservableEntity.cs | 448 ++++----------------- .../Tango.DAL.Observables/ObservablesContext.cs | 443 ++++++++++++++++++++ .../ObservablesEntitiesAdapter.cs | 117 +++--- .../Tango.DAL.Observables/Partials/Machine.cs | 6 +- .../Partials/MachineVersion.cs | 4 +- .../Tango.DAL.Observables.csproj | 4 +- Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs | 8 +- .../Tango.DAL.Remote/DB/RemoteADO.edmx | 48 ++- .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 90 ++--- .../Tango.UnitTesting/CodeGeneration_TST.cs | 20 +- Software/Visual_Studio/Tango.sln | 3 +- .../ObservablesGenerator.cs | 36 +- .../Web/Tango.MachineService/App_Data/Tango.db | Bin 602112 -> 294912 bytes 102 files changed, 2203 insertions(+), 2470 deletions(-) create mode 100644 Software/Visual_Studio/Tango.CodeGeneration/ObservablesContextCodeFile.cs create mode 100644 Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesContextCodeFile.cshtml create mode 100644 Software/Visual_Studio/Tango.DAL.Observables/ObservablesContext.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index b93b255d8..a9a08206b 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 7c79ea466..c220a4591 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs index 5cdee0153..3f0654247 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs @@ -23,7 +23,7 @@ namespace Tango.MachineStudio.DB.Converters if (value is IEnumerable) { IEnumerable eventActions = value as IEnumerable; - return String.Join(", ", eventActions.Select(x => x.ActionTypes.Name)); + return String.Join(", ", eventActions.Select(x => x.ActionType.Name)); } else { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs index 7f6d84ecf..bdf2105a6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs @@ -44,6 +44,7 @@ namespace Tango.MachineStudio.DB.Managers View = view; View.MaxWidth = 1500; + View.MaxHeight = 800; if (action != null) { @@ -81,6 +82,7 @@ namespace Tango.MachineStudio.DB.Managers } view.MaxWidth = 1500; + view.MaxHeight = 800; Header = header; View = view; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EventTypesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EventTypesViewVM.cs index 0325e42ee..687c30470 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EventTypesViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EventTypesViewVM.cs @@ -29,7 +29,7 @@ namespace Tango.MachineStudio.DB.ViewModels foreach (var actionType in SelectedActions) { - if (SelectedEntity.EventTypesActions.ToList().Exists(x => x.ActionTypes == actionType.Entity)) + if (SelectedEntity.EventTypesActions.ToList().Exists(x => x.ActionType == actionType.Entity)) { actionType.IsSelected = true; } @@ -49,22 +49,16 @@ namespace Tango.MachineStudio.DB.ViewModels { base.OnBeforeEntitySave(mode, eventType); + Adapter.Context.EventTypesActions.RemoveRange(eventType.EventTypesActions); + foreach (var actionType in SelectedActions) { - var eventTypeAction = eventType.EventTypesActions.SingleOrDefault(x => x.ActionTypes == actionType.Entity); - - if (eventTypeAction != null && !actionType.IsSelected) - { - eventTypeAction.Delete(); - continue; - } - if (actionType.IsSelected) { eventType.EventTypesActions.Add(new EventTypesAction() { - ActionTypes = actionType.Entity, - EventTypes = eventType, + ActionType = actionType.Entity, + EventType = eventType, ActionTypeGuid = actionType.Entity.Guid, EventTypeGuid = eventType.Guid }); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs index 49bd18822..05171b09f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs @@ -49,22 +49,16 @@ namespace Tango.MachineStudio.DB.ViewModels { base.OnBeforeEntitySave(mode, liquid); + Adapter.Context.LiquidTypesRmls.RemoveRange(liquid.LiquidTypesRmls); + foreach (var rml in SelectedRmls) { - var liquidRml = liquid.LiquidTypesRmls.SingleOrDefault(x => x.Rml == rml.Entity); - - if (liquidRml != null && !rml.IsSelected) - { - liquidRml.Delete(); - continue; - } - if (rml.IsSelected) { liquid.LiquidTypesRmls.Add(new LiquidTypesRml() { Rml = rml.Entity, - LiquidTypes = liquid, + LiquidType = liquid, RmlGuid = rml.Entity.Guid, LiquidTypeGuid = liquid.Guid }); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RolesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RolesViewVM.cs index 8ce95f736..50caf4c6d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RolesViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RolesViewVM.cs @@ -50,16 +50,10 @@ namespace Tango.MachineStudio.DB.ViewModels { base.OnBeforeEntitySave(mode, role); + Adapter.Context.RolesPermissions.RemoveRange(role.RolesPermissions); + foreach (var permission in SelectedPermissions) { - var rolePermission = role.RolesPermissions.SingleOrDefault(x => x.Permission == permission.Entity); - - if (rolePermission != null && !permission.IsSelected) - { - rolePermission.Delete(); - continue; - } - if (permission.IsSelected) { role.RolesPermissions.Add(new RolesPermission() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs index 044b8a88a..e338746ff 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs @@ -50,26 +50,19 @@ namespace Tango.MachineStudio.DB.ViewModels { base.OnBeforeEntitySave(mode, user); + Adapter.Context.UsersRoles.RemoveRange(user.UsersRoles); + foreach (var role in SelectedRoles) { - var userRole = user.UsersRoles.SingleOrDefault(x => x.Role == role.Entity); - - if (userRole != null) - { - userRole.Deleted = !role.IsSelected; - } - else + if (role.IsSelected) { - if (role.IsSelected) + user.UsersRoles.Add(new UsersRole() { - user.UsersRoles.Add(new UsersRole() - { - Role = role.Entity, - User = user, - RoleGuid = role.Entity.Guid, - UserGuid = user.Guid - }); - } + Role = role.Entity, + User = user, + RoleGuid = role.Entity.Guid, + UserGuid = user.Guid + }); } } } @@ -80,7 +73,7 @@ namespace Tango.MachineStudio.DB.ViewModels if (EditEntity.Email != null) { - if (Adapter.Users.ToList().Exists(x => x != EditEntity && x.Email.ToLower() == EditEntity.Email.ToLower())) + if (Adapter.Users.ToList().Exists(x => x.Guid != EditEntity.Guid && x.Email.ToLower() == EditEntity.Email.ToLower())) { ValidationErrors.Add("Email already exist"); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml index 9cd01cfc4..080591c15 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml @@ -32,7 +32,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml index e72146525..6eb693780 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml @@ -23,13 +23,13 @@ - + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml index afbaf660a..2e34379e5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml @@ -28,25 +28,25 @@ - + - + - + - + - + - + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml index 235e49cc3..819dbd1c7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml @@ -16,13 +16,13 @@ - - - - - - - + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml index 543e6b40c..537bdb9f7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml @@ -29,7 +29,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -61,7 +61,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml index e5043e3e2..0837bbf9f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml @@ -25,7 +25,7 @@ - + @@ -35,10 +35,10 @@ - + - + @@ -46,14 +46,14 @@ - + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlView.xaml index a3b3f5eed..2fbe2365c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlView.xaml @@ -21,7 +21,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlsView.xaml index f96402432..11f781e5b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlsView.xaml @@ -16,9 +16,9 @@ - + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml index 50a1c790b..a15f9c9e1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml @@ -21,7 +21,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml index 08cac568f..be917634a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml @@ -16,7 +16,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineView.xaml index 0a7ee4c32..ab880a8a8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineView.xaml @@ -22,7 +22,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml index ea48667d9..c6febd63c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml @@ -16,7 +16,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml index 1e3933ce0..75b559bf2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml @@ -23,7 +23,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml index d9ad83f68..0e20ce5af 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml @@ -21,7 +21,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml index adf5310ee..43a17d8e4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml @@ -32,10 +32,10 @@ - + - + @@ -50,19 +50,19 @@ - + - + - + - + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml index 0a02c6821..86a61d400 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml @@ -23,23 +23,23 @@ - + - + - - - - - + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 0742ca752..8f3d2a7e3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -44,7 +44,19 @@ namespace Tango.MachineStudio.Developer.ViewModels public Machine SelectedMachine { get { return _selectedMachine; } - set { _selectedMachine = value; RaisePropertyChangedAuto(); OnMachineChanged(); InvalidateRelayCommands(); } + set + { + _selectedMachine = value; + RaisePropertyChangedAuto(); + OnMachineChanged(); + InvalidateRelayCommands(); + + if (_selectedMachine != null) + { + _selectedMachine.Saved -= SelectedMachine_Saved; + _selectedMachine.Saved += SelectedMachine_Saved; + } + } } private List _liquidTypesRmls; @@ -104,7 +116,13 @@ namespace Tango.MachineStudio.Developer.ViewModels public Rml SelectedRML { get { return _selectedRML; } - set { _selectedRML = value; RaisePropertyChangedAuto(); InvalidateLiquidFactorsAndProcessTables(); InvalidateRelayCommands(); } + set + { + _selectedRML = value; + RaisePropertyChangedAuto(); + InvalidateLiquidFactorsAndProcessTables(); + InvalidateRelayCommands(); + } } private bool _isSideBarOpened; @@ -205,6 +223,20 @@ namespace Tango.MachineStudio.Developer.ViewModels #endregion + #region Event Handlers + + /// + /// Handles the Saved event of the SelectedMachine. + /// + /// The source of the event. + /// The instance containing the event data. + private void SelectedMachine_Saved(object sender, EventArgs e) + { + InvalidateLiquidFactorsAndProcessTables(); + } + + #endregion + #region Virtual Methods /// @@ -278,7 +310,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var table in RmlProcessParametersTableGroup.ProcessParametersTables) { var newTable = table.CloneEntity(); - newTable.ProcessParametersTablesGroups = group; + newTable.ProcessParametersTablesGroup = group; tables.Add(newTable); } @@ -313,7 +345,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { if (SelectedRML != null && SelectedMachine != null) { - LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidTypes).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); + LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.SingleOrDefault(x => x.Active); if (RmlProcessParametersTableGroup != null) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index a18e4145e..243165cd5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -219,7 +219,7 @@ - + @@ -455,7 +455,7 @@ Winding Method - + @@ -736,7 +736,7 @@ - + private void SetVersionConfiguration() { - if (Machine.MachineVersions != null) + if (Machine.MachineVersion != null) { - Configuration = Machine.MachineVersions.Configuration.CloneConfiguration(); + Configuration = Machine.MachineVersion.DefaultConfiguration.CloneConfiguration(); } else { @@ -605,8 +605,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { if (vm.SelectedVersion != null) { - vm.SelectedVersion.Configuration = Configuration.CloneConfiguration(); - vm.SelectedVersion.DefaultConfigurationGuid = vm.SelectedVersion.Configuration.Guid; + vm.SelectedVersion.DefaultConfiguration = Configuration.CloneConfiguration(); + vm.SelectedVersion.DefaultConfigurationGuid = vm.SelectedVersion.DefaultConfiguration.Guid; await vm.SelectedVersion.SaveAsync(); } else @@ -615,8 +615,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels newVersion.Version = vm.Version; newVersion.Name = vm.VersionName; - newVersion.Configuration = Configuration.CloneConfiguration(); - newVersion.DefaultConfigurationGuid = newVersion.Configuration.Guid; + newVersion.DefaultConfiguration = Configuration.CloneConfiguration(); + newVersion.DefaultConfigurationGuid = newVersion.DefaultConfiguration.Guid; await newVersion.SaveAsync(); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml index a7e604352..691fa6987 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -57,8 +57,8 @@ - - + + @@ -105,7 +105,7 @@ - + @@ -123,7 +123,7 @@ - - - - - + # @@ -333,13 +287,12 @@ - - + + - @@ -378,11 +331,11 @@ - + - + @@ -394,7 +347,7 @@ Name - + @@ -404,7 +357,7 @@ Winding Method - + @@ -415,8 +368,8 @@ Inter Segment - - + + @@ -428,7 +381,7 @@ Lubrication - + @@ -441,7 +394,7 @@ - + @@ -619,7 +572,7 @@ - + - + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 7e0ef2eb5..cd4fc1aeb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -185,6 +185,10 @@ {38197109-8610-4d3f-92b9-16d48df94d7c} Tango.DAL.Remote + + {b112d89a-a106-41ae-a0c1-4abc84c477f5} + Tango.DragAndDrop + {de2f2b86-025b-4f26-83a4-38bd48224ed5} Tango.Editors diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs index d7161953f..948be3c4a 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs @@ -41,5 +41,18 @@ public static class ObservableCollectionExtensions collection[index1] = collection[index2]; collection[index2] = tmp; } + + /// + /// Removes the dragged element and inserts it after the dropped element position. + /// + /// + /// The collection. + /// The dragged element. + /// The dropped element. + public static void DragAndDrop(this ObservableCollection collection, T dragged, T dropped) + { + collection.Remove(dragged); + collection.Insert(collection.IndexOf(dropped), dragged); + } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs b/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs index eb16d150d..15fb521ba 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs @@ -54,12 +54,12 @@ namespace Tango.Integration.Observables /// /// Attaches this observable to the proper DbSet. /// - void Attach(); + void Attach(ObservablesContext context = null); /// /// Detaches this observable from the proper DbSet. /// - void Detach(); + void Detach(ObservablesContext context = null); /// /// Saves the changes on this entity to database asynchronously. @@ -76,12 +76,12 @@ namespace Tango.Integration.Observables /// /// Deletes this entity from the database. /// - void Delete(); + void Delete(ObservablesContext context = null); /// /// Deletes this entity without saving changes to data base. /// - void DefferedDelete(); + void DefferedDelete(ObservablesContext context = null); /// /// Deletes this entity from the database. diff --git a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs index d5b218453..f92d9dfa0 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs @@ -44,6 +44,7 @@ namespace Tango.Integration.Observables /// Gets or sets the entity identifier. /// [Column("ID")] + [JsonIgnore] [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public Int32 ID { @@ -57,6 +58,7 @@ namespace Tango.Integration.Observables /// [Key] [Column("GUID")] + [JsonIgnore] public String Guid { get { return _guid; } @@ -121,17 +123,17 @@ namespace Tango.Integration.Observables /// /// Attaches this entity to the proper DbSet. /// - public virtual void Attach() + public virtual void Attach(ObservablesContext context = null) { - GetDbSet().Add(this as T); + GetDbSet(context).Add(this as T); } /// /// Detaches this observable from the proper DbSet. /// - public virtual void Detach() + public virtual void Detach(ObservablesContext context = null) { - GetDbSet().Remove(this as T); + GetDbSet(context).Remove(this as T); } /// @@ -150,15 +152,15 @@ namespace Tango.Integration.Observables /// Reloads this observable entity. /// /// - public Task Reload() + public Task Reload(ObservablesContext context) { - return ObservablesEntitiesAdapter.Instance.Context.Entry(this).ReloadAsync(); + return context.Entry(this).ReloadAsync(); } /// /// Deletes this entity from the database /// - public virtual void Delete() + public virtual void Delete(ObservablesContext context = null) { var delProp = this.GetType().GetProperty("Deleted"); @@ -169,7 +171,7 @@ namespace Tango.Integration.Observables } else { - GetDbSet().Remove(this as T); + GetDbSet(context).Remove(this as T); Save(); } } @@ -177,9 +179,9 @@ namespace Tango.Integration.Observables /// /// Deletes this entity without saving changes to data base. /// - public virtual void DefferedDelete() + public virtual void DefferedDelete(ObservablesContext context = null) { - GetDbSet().Remove(this as T); + GetDbSet(context).Remove(this as T); } /// @@ -193,17 +195,15 @@ namespace Tango.Integration.Observables }); } - /// - /// Gets the observable database set. - /// - /// - public DbSet GetDbSet() + public DbSet GetDbSet(ObservablesContext context) { + context = context != null ? context : ObservablesEntitiesAdapter.Instance.Context; + String tabelName = this.GetType().Name.PluralizeMVC(); var p = typeof(ObservablesContext).GetProperty(tabelName); if (p != null) { - var set1 = p.GetValue(ObservablesEntitiesAdapter.Instance.Context) as DbSet; + var set1 = p.GetValue(context) as DbSet; return set1; } else @@ -212,7 +212,7 @@ namespace Tango.Integration.Observables p = typeof(ObservablesContext).GetProperty(tabelName); if (p != null) { - var set2 = p.GetValue(ObservablesEntitiesAdapter.Instance.Context) as DbSet; + var set2 = p.GetValue(context) as DbSet; return set2; } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Configuration.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Configuration.cs index c60102671..3622169c9 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Configuration.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Configuration.cs @@ -8,21 +8,21 @@ namespace Tango.Integration.Observables { public partial class Configuration { - public override void DefferedDelete() + public override void DefferedDelete(ObservablesContext context = null) { - IdsPacks.ToList().ForEach(x => x.DefferedDelete()); + IdsPacks.ToList().ForEach(x => x.DefferedDelete(context)); var machine_configurations = ObservablesEntitiesAdapter.Instance.MachinesConfigurations.Where(x => x.Configuration == this); - MachinesConfigurations.ToList().ForEach(x => x.DefferedDelete()); - base.DefferedDelete(); + MachinesConfigurations.ToList().ForEach(x => x.DefferedDelete(context)); + base.DefferedDelete(context); IdsPacks.Clear(); } - public override void Delete() + public override void Delete(ObservablesContext context = null) { - IdsPacks.ToList().ForEach(x => x.DefferedDelete()); + IdsPacks.ToList().ForEach(x => x.DefferedDelete(context)); var machine_configurations = ObservablesEntitiesAdapter.Instance.MachinesConfigurations.Where(x => x.Configuration == this); - MachinesConfigurations.ToList().ForEach(x => x.DefferedDelete()); - base.Delete(); + MachinesConfigurations.ToList().ForEach(x => x.DefferedDelete(context)); + base.Delete(context); IdsPacks.Clear(); } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs index 850003e60..bb26acc39 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs @@ -12,7 +12,7 @@ namespace Tango.Integration.Observables /// /// Deletes this entity from the database /// - public override void Delete() + public override void Delete(ObservablesContext context = null) { foreach (var machine_config in MachinesConfigurations) { diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/MachineVersion.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/MachineVersion.cs index c7d1f8321..18799b7ed 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Partials/MachineVersion.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/MachineVersion.cs @@ -8,7 +8,7 @@ namespace Tango.Integration.Observables { public partial class MachineVersion { - public override void Delete() + public override void Delete(ObservablesContext context = null) { this.DefaultConfiguration.Delete(); base.Delete(); diff --git a/Software/Visual_Studio/Tango.Integration/Printing/BrushStop.cs b/Software/Visual_Studio/Tango.Integration/Printing/BrushStop.cs index ebc77e615..ae8aa0e37 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/BrushStop.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/BrushStop.cs @@ -37,7 +37,6 @@ namespace Tango.Integration.Observables set { _liquidVolumes = value; RaisePropertyChangedAuto(); } } - private Color _color; /// /// Gets or sets the brush stop color. /// @@ -45,13 +44,12 @@ namespace Tango.Integration.Observables [JsonIgnore] public Color Color { - get { return _color; } + get { return Color.FromRgb((byte)_red, (byte)_green,(byte)_blue); } set { - _color = value; - _red = _color.R; - _green = _color.G; - _blue = _color.B; + _red = value.R; + _green = value.G; + _blue = value.B; RaisePropertyChanged(nameof(Color)); } } @@ -62,7 +60,7 @@ namespace Tango.Integration.Observables [NotMapped] public int Index { - get { return Segment.BrushStops.IndexOf(this); } + get { return StopIndex; } } /// @@ -72,7 +70,7 @@ namespace Tango.Integration.Observables [JsonIgnore] public bool IsFirst { - get { return Segment.BrushStops.IndexOf(this) == 0; } + get { return StopIndex == 0; } } /// @@ -82,7 +80,7 @@ namespace Tango.Integration.Observables [JsonIgnore] public bool IsLast { - get { return Segment.BrushStops.IndexOf(this) == Segment.BrushStops.Count - 1; } + get { return StopIndex == Segment.BrushStops.Count - 1; } } /// @@ -146,6 +144,16 @@ namespace Tango.Integration.Observables } } + public void SetStopIndex(int index) + { + _stopindex = index; + } + + public void RaiseStopIndex() + { + StopIndex = _stopindex; + } + #endregion #region Override Methods @@ -229,8 +237,6 @@ namespace Tango.Integration.Observables _l = lab.L; _a = lab.A; _b = lab.B; - - _color = Color.FromRgb((byte)_red, (byte)_green, (byte)_blue); } #endregion diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs index 1cc4865f2..49c5fbdae 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs @@ -124,7 +124,7 @@ namespace Tango.Integration.Observables { for (int i = 0; i < Segments.Count; i++) { - Segments[i].SegmentIndex = i; + Segments[i].SegmentIndex = i + 1; for (int j = 0; j < Segments[i].BrushStops.Count; j++) { @@ -146,11 +146,11 @@ namespace Tango.Integration.Observables return cloned; } - public override void DefferedDelete() + public override void DefferedDelete(ObservablesContext context = null) { - Segments.ToList().ForEach(x => x.DefferedDelete()); + Segments.ToList().ForEach(x => x.DefferedDelete(context)); Segments.Clear(); - base.DefferedDelete(); + base.DefferedDelete(context); } #endregion diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs b/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs index 6213240ed..d3e50ec37 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs @@ -68,11 +68,11 @@ namespace Tango.Integration.Observables return cloned; } - public override void DefferedDelete() + public override void DefferedDelete(ObservablesContext context = null) { - BrushStops.ToList().ForEach(x => x.DefferedDelete()); + BrushStops.ToList().ForEach(x => x.DefferedDelete(context)); BrushStops.Clear(); - base.DefferedDelete(); + base.DefferedDelete(context); } } } -- cgit v1.3.1