diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-07 12:53:01 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-07 12:53:01 +0200 |
| commit | 8d2dc68fdddc51bc24ac6f41feb97460a7d27372 (patch) | |
| tree | 32876416b128d93a47d5b0a228fc405aca0479e9 /Software | |
| parent | 3d97a759dc712eca6750443b2367c8f755ebb11b (diff) | |
| download | Tango-8d2dc68fdddc51bc24ac6f41feb97460a7d27372.tar.gz Tango-8d2dc68fdddc51bc24ac6f41feb97460a7d27372.zip | |
Implemented validation on machine designer.
Machine Designer seems to be working properly...
Diffstat (limited to 'Software')
16 files changed, 247 insertions, 79 deletions
diff --git a/Software/DB/Tango.db b/Software/DB/Tango.db Binary files differindex 555cd32f7..12c88039d 100644 --- a/Software/DB/Tango.db +++ b/Software/DB/Tango.db diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex e574c463b..27dd1f996 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex ba73fcbd8..6bd9fb7c5 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index 96d7ddb8f..1a2564e0c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -55,6 +55,9 @@ <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath> </Reference> + <Reference Include="SimpleValidator, Version=0.6.1.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 22e350745..be28f92b5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -12,6 +12,7 @@ using Tango.Core.Helpers; using Tango.DAL.Observables; using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI; +using SimpleValidator.Extensions; namespace Tango.MachineStudio.MachineDesigner.ViewModels { @@ -133,6 +134,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } } + public void DropIdsPack(IdsPack idsPack1, IdsPack idsPack2) + { + Configuration.IdsPacks.Swap(idsPack1, idsPack2); + } + private void OnHistoryConfigurationSelected() { if (SelectedHistoryConfiguration != null) @@ -240,7 +246,10 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels if (value != null) { - return value.ToLower().Contains(Filter.ToLower()); + if (value.ToLower().Contains(Filter.ToLower())) + { + return true; + } } } @@ -251,9 +260,115 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels private async void Save() { + //Validate + + List<String> errors = new List<string>(); + + if (Machine.MachineVersions == null) + { + errors.Add("Machine Version is required."); + } + + if (Machine.Name.IsNullOrWhiteSpace()) + { + errors.Add("Machine name is required."); + } + + if (Machine.Organization == null) + { + errors.Add("Machine organization is required."); + } + + if (Machine.SerialNumber.IsNullOrWhiteSpace()) + { + errors.Add("Machine serial number is required."); + } + + if (Configuration.Name.IsNullOrWhiteSpace()) + { + errors.Add("Configuration name is required."); + } + + if (Configuration.ApplicationDisplayPanelVersions == null) + { + errors.Add("Touch Panel is required."); + } + + if (Configuration.ApplicationFirmwareVersions == null) + { + errors.Add("Application Firmware is required."); + } + + if (Configuration.ApplicationOsVersions == null) + { + errors.Add("Application OS Version is required."); + } + + if (Configuration.ApplicationVersions == null) + { + errors.Add("Application Version is required."); + } + + if (Configuration.EmbeddedFirmwareVersions == null) + { + errors.Add("Embedded Firmware is required."); + } + + if (Configuration.EmbeddedSoftwareVersions == null) + { + errors.Add("Embedded Software is required."); + } + + if (Configuration.HardwareVersions == null) + { + errors.Add("Hardware Version is required."); + } + + foreach (var pack in Configuration.IdsPacks) + { + if (pack.Name.IsNullOrWhiteSpace()) + { + errors.Add(String.Format("Name is required on IDS pack number {0}.", Configuration.IdsPacks.IndexOf(pack) + 1)); + continue; + } + if (pack.CartridgeTypes == null) + { + errors.Add(String.Format("Cartridge type is required on IDS pack {0}.", pack.Name)); + } + if (pack.Dispenser == null) + { + errors.Add(String.Format("Dispenser is required on IDS pack {0}.", pack.Name)); + } + if (pack.LiquidTypes == null) + { + errors.Add(String.Format("Liquid type is required on IDS pack {0}.", pack.Name)); + } + if (pack.MidTankTypes == null) + { + errors.Add(String.Format("Mid Tank type is required on IDS pack {0}.", pack.Name)); + } + } + + if (errors.Count > 0) + { + String errorsString = "Please fix the following validation errors before trying to save." + Environment.NewLine + Environment.NewLine; + errorsString += String.Join(Environment.NewLine, errors); + _notification.ShowError(errorsString); + return; + } + + //Validate + _isSaving = true; InvalidateRelayCommands(); + foreach (var ids in Configuration.IdsPacks) + { + ids.PackIndex = Configuration.IdsPacks.IndexOf(ids); + ids.Configuration = Configuration; + ids.ConfigurationGuid = Configuration.Guid; + } + try { using (_notification.PushTaskItem("Saving Machine Configuration...")) @@ -282,12 +397,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } else { - foreach (var ids in Configuration.IdsPacks) - { - ids.Configuration = Configuration; - ids.ConfigurationGuid = Configuration.Guid; - } - var machine = Adapter.Machines.Single(x => x.SerialNumber.ToLower() == Machine.SerialNumber.ToLower()); //Set 'Real machine' parameters... diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml index 03a3e2636..68c772c0c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml @@ -85,19 +85,21 @@ <Grid ClipToBounds="False"> <StackPanel> - <TextBlock FontSize="30" FontStyle="Italic" VerticalAlignment="Center" Margin="50 10 10 0" Foreground="Silver" FontWeight="Bold">MACHINE DESIGNER</TextBlock> - <StackPanel Orientation="Horizontal" Margin="280 10 0 0"> - <fa:ImageAwesome Icon="Key" Width="24" Height="24" Foreground="Silver"></fa:ImageAwesome> - <autoComplete:AutoCompleteTextBox FontSize="16" Width="300" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Enter serial number" DisplayMember="SerialNumber" Provider="{StaticResource ResourceKey=MachinesProvider}" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}"> - <autoComplete:AutoCompleteTextBox.ItemTemplate> - <DataTemplate> - <TextBlock Text="{Binding SerialNumber}"></TextBlock> - </DataTemplate> - </autoComplete:AutoCompleteTextBox.ItemTemplate> - <autoComplete:AutoCompleteTextBox.LoadingContent> - <TextBlock Text="Loading..." Margin="5" FontSize="14" /> - </autoComplete:AutoCompleteTextBox.LoadingContent> - </autoComplete:AutoCompleteTextBox> + <StackPanel Orientation="Horizontal"> + <TextBlock FontSize="30" FontStyle="Italic" VerticalAlignment="Center" Margin="50 10 10 0" Foreground="Silver" FontWeight="Bold">MACHINE DESIGNER</TextBlock> + <StackPanel Orientation="Horizontal" Margin="20 10 0 0" VerticalAlignment="Center"> + <fa:ImageAwesome Icon="Key" Width="24" Height="24" Foreground="Silver"></fa:ImageAwesome> + <autoComplete:AutoCompleteTextBox FontSize="16" Width="300" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Enter serial number" DisplayMember="SerialNumber" Provider="{StaticResource ResourceKey=MachinesProvider}" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}"> + <autoComplete:AutoCompleteTextBox.ItemTemplate> + <DataTemplate> + <TextBlock Text="{Binding SerialNumber}"></TextBlock> + </DataTemplate> + </autoComplete:AutoCompleteTextBox.ItemTemplate> + <autoComplete:AutoCompleteTextBox.LoadingContent> + <TextBlock Text="Loading..." Margin="5" FontSize="14" /> + </autoComplete:AutoCompleteTextBox.LoadingContent> + </autoComplete:AutoCompleteTextBox> + </StackPanel> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 50 0"> @@ -321,8 +323,14 @@ <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> </Grid> - <TextBlock Canvas.Top="420" Canvas.Left="340" FontStyle="Italic" Foreground="Gray">Mid Tanks</TextBlock> - <Grid Width="53" Height="44" Canvas.Top="441" Canvas.Left="362"> + <TextBlock Canvas.Top="395" Canvas.Left="331" FontStyle="Italic" Foreground="Gray">Mid Tanks</TextBlock> + <Grid Width="62" Height="29" Canvas.Top="418" Canvas.Left="357"> + <Rectangle Stroke="Gray" VerticalAlignment="Bottom" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + </Grid> + + <TextBlock Canvas.Top="469" Canvas.Left="304" FontStyle="Italic" Foreground="Gray">Cartridges</TextBlock> + <Grid Width="87" Height="10" Canvas.Top="487" Canvas.Left="332"> <Rectangle Stroke="Gray" VerticalAlignment="Bottom" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> </Grid> @@ -510,8 +518,8 @@ </ListBox> </Expander> <Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" /> - <Expander HorizontalAlignment="Stretch" Header="Cartridges"> - <ListBox ItemsSource="{Binding Adapter.CartridgeTypesViewSource}" HorizontalContentAlignment="Stretch"> + <Expander HorizontalAlignment="Stretch" Header="Mid Tanks"> + <ListBox ItemsSource="{Binding Adapter.MidTankTypesViewSource}" HorizontalContentAlignment="Stretch"> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> @@ -523,7 +531,7 @@ <DataTemplate> <Grid Background="Transparent" IsHitTestVisible="True" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"> <StackPanel Orientation="Horizontal" Margin="2 8"> - <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/cartridge.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/tank.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="5 0 0 0" IsHitTestVisible="False"> <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Name}"></Run></TextBlock> </StackPanel> @@ -536,8 +544,8 @@ </ListBox> </Expander> <Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" /> - <Expander HorizontalAlignment="Stretch" Header="Mid Tanks"> - <ListBox ItemsSource="{Binding Adapter.MidTankTypesViewSource}" HorizontalContentAlignment="Stretch"> + <Expander HorizontalAlignment="Stretch" Header="Cartridges"> + <ListBox ItemsSource="{Binding Adapter.CartridgeTypesViewSource}" HorizontalContentAlignment="Stretch"> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> @@ -549,7 +557,7 @@ <DataTemplate> <Grid Background="Transparent" IsHitTestVisible="True" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"> <StackPanel Orientation="Horizontal" Margin="2 8"> - <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/tank.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/cartridge.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="5 0 0 0" IsHitTestVisible="False"> <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Name}"></Run></TextBlock> </StackPanel> @@ -762,9 +770,9 @@ </ScrollViewer> <Grid Grid.Row="1" Margin="10"> - <Button Height="50" Command="{Binding SaveCommand}"> + <Button Height="50" Command="{Binding SaveCommand}" Margin="0 0 15 0"> <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon Width="24" Height="24" VerticalAlignment="Center" Kind="ContentSave"></materialDesign:PackIcon> + <materialDesign:PackIcon Width="24" Height="24" VerticalAlignment="Center" Kind="ContentSaveSettings"></materialDesign:PackIcon> <TextBlock FontSize="18" Margin="10 0 0 0" VerticalAlignment="Center">SAVE</TextBlock> </StackPanel> </Button> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs index 7c2a38401..f38c8f8d6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs @@ -102,6 +102,10 @@ namespace Tango.MachineStudio.MachineDesigner.Views { _vm.DropMidTankType(e.Draggable.DataContext as MidTankType, e.Droppable.DataContext as IdsPack); } + else if (e.Draggable.DataContext is IdsPack) + { + _vm.DropIdsPack(e.Draggable.DataContext as IdsPack, e.Droppable.DataContext as IdsPack); + } } private void OnTabletDrop(object sender, DropEventArgs e) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config index 42945b407..aada4ebd7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config @@ -6,4 +6,5 @@ <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> + <package id="SimpleValidator" version="0.6.1.0" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs index 57acccab7..4f2d9ca20 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObservableCollectionExtensions.cs @@ -22,5 +22,15 @@ public static class ObservableCollectionExtensions items.Remove(oldElement); items.Insert(index, newElement); } + + public static void Swap<T>(this ObservableCollection<T> items, T element1, T element2) + { + int index1 = items.IndexOf(element1); + int index2 = items.IndexOf(element2); + + T tmp = items[index1]; + items[index1] = items[index2]; + items[index2] = tmp; + } } diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/IDS_PACKS.cs b/Software/Visual_Studio/Tango.DAL.Local/DB/IDS_PACKS.cs index c4ffb0cf2..8091dd5d2 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/IDS_PACKS.cs +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/IDS_PACKS.cs @@ -24,5 +24,6 @@ namespace Tango.DAL.Local.DB public string CARTRIDGE_TYPE_GUID { get; set; } public string MID_TANK_TYPE_GUID { get; set; } public string NAME { get; set; } + public long PACK_INDEX { get; set; } } } diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx index c90afa5ef..85f8c0bad 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx @@ -274,6 +274,7 @@ <Property Name="CARTRIDGE_TYPE_GUID" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> <Property Name="MID_TANK_TYPE_GUID" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> <Property Name="NAME" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> + <Property Name="PACK_INDEX" Type="integer" Nullable="false" /> </EntityType> <EntityType Name="LINEAR_MASS_DENSITY_UNITS"> <Key> @@ -886,6 +887,7 @@ <Property Name="CARTRIDGE_TYPE_GUID" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> <Property Name="MID_TANK_TYPE_GUID" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> <Property Name="NAME" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> + <Property Name="PACK_INDEX" Type="Int64" Nullable="false" /> </EntityType> <EntityType Name="LINEAR_MASS_DENSITY_UNITS"> <Key> @@ -1422,6 +1424,7 @@ <EntitySetMapping Name="IDS_PACKS"> <EntityTypeMapping TypeName="LocalModel.IDS_PACKS"> <MappingFragment StoreEntitySet="IDS_PACKS"> + <ScalarProperty Name="PACK_INDEX" ColumnName="PACK_INDEX" /> <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="MID_TANK_TYPE_GUID" ColumnName="MID_TANK_TYPE_GUID" /> <ScalarProperty Name="CARTRIDGE_TYPE_GUID" ColumnName="CARTRIDGE_TYPE_GUID" /> diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs index 0da97bcb7..35afa5470 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs @@ -124,6 +124,25 @@ namespace Tango.DAL.Observables } + private Int32 _packindex; + /// <summary> + /// Gets or sets the idspack pack index. + /// </summary> + [EntityFieldName("PACK_INDEX")] + public Int32 PackIndex + { + get + { + return _packindex; + } + + set + { + _packindex = value; RaisePropertyChanged(nameof(PackIndex)); + } + + } + private CartridgeType _cartridgetypes; /// <summary> /// Gets or sets the idspack cartridge types. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs index 63f33d1cb..756dee760 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs @@ -20,7 +20,7 @@ namespace Tango.DAL.Observables { public event Action Initialized; - private static object _syncLock = new object(); + private static object _syncLock; private static ObservablesEntitiesAdapter _instance; @@ -80,6 +80,8 @@ namespace Tango.DAL.Observables public void Invalidate(bool initializing = false) { + _syncLock = new object(); + LoadedObjectsService.Reset(); if (initializing) @@ -216,11 +218,11 @@ namespace Tango.DAL.Observables InitCollectionSources(); - BindingOperations.EnableCollectionSynchronization(Machines, _syncLock); - BindingOperations.EnableCollectionSynchronization(MachinesViewSource, _syncLock); + //BindingOperations.EnableCollectionSynchronization(Machines, _syncLock); + //BindingOperations.EnableCollectionSynchronization(MachinesViewSource, _syncLock); - BindingOperations.EnableCollectionSynchronization(MachinesConfigurations, _syncLock); - BindingOperations.EnableCollectionSynchronization(MachinesConfigurationsViewSource, _syncLock); + //BindingOperations.EnableCollectionSynchronization(MachinesConfigurations, _syncLock); + //BindingOperations.EnableCollectionSynchronization(MachinesConfigurationsViewSource, _syncLock); } private ICollectionView CreateCollectionView<T>(ObservableCollection<T> collection) diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/IDS_PACKS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/IDS_PACKS.cs index 2ae0d07e5..140f9114a 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/IDS_PACKS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/IDS_PACKS.cs @@ -24,6 +24,7 @@ namespace Tango.DAL.Remote.DB public string CARTRIDGE_TYPE_GUID { get; set; } public string MID_TANK_TYPE_GUID { get; set; } public string NAME { get; set; } + public int PACK_INDEX { get; set; } public virtual CARTRIDGE_TYPES CARTRIDGE_TYPES { get; set; } public virtual CONFIGURATION CONFIGURATION { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 73df729c2..ffed19a3f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -275,6 +275,7 @@ <Property Name="CARTRIDGE_TYPE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="MID_TANK_TYPE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> + <Property Name="PACK_INDEX" Type="int" Nullable="false" /> </EntityType> <EntityType Name="LINEAR_MASS_DENSITY_UNITS"> <Key> @@ -731,7 +732,9 @@ </ReferentialConstraint> </Association> <Association Name="FK_IDS_PACKS_CONFIGURATIONS"> - <End Role="CONFIGURATIONS" Type="Self.CONFIGURATIONS" Multiplicity="1" /> + <End Role="CONFIGURATIONS" Type="Self.CONFIGURATIONS" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Role="IDS_PACKS" Type="Self.IDS_PACKS" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="CONFIGURATIONS"> @@ -1856,6 +1859,7 @@ <Property Name="CARTRIDGE_TYPE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="MID_TANK_TYPE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> + <Property Name="PACK_INDEX" Type="Int32" Nullable="false" /> <NavigationProperty Name="CARTRIDGE_TYPES" Relationship="RemoteModel.FK_IDS_PACKS_CARTRIDGE_TYPES" FromRole="IDS_PACKS" ToRole="CARTRIDGE_TYPES" /> <NavigationProperty Name="CONFIGURATION" Relationship="RemoteModel.FK_IDS_PACKS_CONFIGURATIONS" FromRole="IDS_PACKS" ToRole="CONFIGURATION" /> <NavigationProperty Name="DISPENSER" Relationship="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_DISPENSERS" FromRole="IDS_PACKS" ToRole="DISPENSER" /> @@ -2344,7 +2348,9 @@ </ReferentialConstraint> </Association> <Association Name="FK_IDS_PACKS_CONFIGURATIONS"> - <End Type="RemoteModel.CONFIGURATION" Role="CONFIGURATION" Multiplicity="1" /> + <End Type="RemoteModel.CONFIGURATION" Role="CONFIGURATION" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Type="RemoteModel.IDS_PACKS" Role="IDS_PACKS" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="CONFIGURATION"> @@ -3009,6 +3015,7 @@ <EntitySetMapping Name="IDS_PACKS"> <EntityTypeMapping TypeName="RemoteModel.IDS_PACKS"> <MappingFragment StoreEntitySet="IDS_PACKS"> + <ScalarProperty Name="PACK_INDEX" ColumnName="PACK_INDEX" /> <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="MID_TANK_TYPE_GUID" ColumnName="MID_TANK_TYPE_GUID" /> <ScalarProperty Name="CARTRIDGE_TYPE_GUID" ColumnName="CARTRIDGE_TYPE_GUID" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index c8d5cd035..a846f3364 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,48 +5,48 @@ <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1"> - <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="13.5" PointY="40.375" /> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="3" PointY="22.625" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="9.625" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="23.25" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="20.125" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="0.75" PointY="13.875" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="3" PointY="18.5" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE" Width="1.5" PointX="5.25" PointY="18.5" /> - <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="12.75" PointY="11" /> - <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="16.25" PointY="20.125" /> - <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="8" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="3" PointY="26.875" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="0.75" PointY="5.125" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="3" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="26.375" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="17" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="7.5" PointY="15.25" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="15.75" PointY="11.375" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="11.75" PointY="20.875" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="11.75" PointY="3.75" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="29.5" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="5.25" PointY="8.875" /> - <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="11.75" PointY="30" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="14.5" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="16.25" PointY="16.125" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="5.25" PointY="14" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="7.5" PointY="10.375" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="9.75" PointY="6.875" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="9.75" PointY="10.75" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="11.75" PointY="27.125" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="11.75" PointY="17.375" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="11.75" PointY="24" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="11.75" PointY="33.125" /> - <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="3" PointY="4.25" /> - <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="5.25" PointY="24.875" /> - <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="10.5" PointY="40.375" /> - <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="14" PointY="15" /> - <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="10.5" PointY="36.25" /> - <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="12.75" PointY="36.375" /> - <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="5.75" PointY="2.625" /> - <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="7.5" PointY="5.75" /> - <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="12.75" PointY="7.375" /> + <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="15.5" PointY="11.625" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="3" PointY="24.875" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="25.5" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="22.375" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="28.625" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="0.75" PointY="19.25" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="3" PointY="17.625" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE" Width="1.5" PointX="5.25" PointY="17.625" /> + <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="9.75" PointY="13.25" /> + <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="17.25" PointY="20.125" /> + <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="7.125" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="3" PointY="29.125" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="0.75" PointY="3.5" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="3" PointY="3.375" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="8.75" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="13" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="10.5" PointY="17.5" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="17.75" PointY="12.625" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="12.75" PointY="31" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="12.75" PointY="17.5" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="16.125" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="5.25" PointY="7.875" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="12.75" PointY="24.75" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="13.75" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="17.25" PointY="16.625" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="5.25" PointY="13.375" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="7.5" PointY="9.625" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="9.75" PointY="9.125" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="12.75" PointY="10" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="12.75" PointY="21.875" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="12.75" PointY="27.875" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="12.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="12.75" PointY="34.125" /> + <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="3" PointY="20.875" /> + <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="5.25" PointY="27" /> + <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="10.5" PointY="41.625" /> + <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="15" PointY="15" /> + <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="10.5" PointY="37.5" /> + <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="12.75" PointY="37.625" /> + <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="5.75" PointY="1.625" /> + <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="10.5" PointY="4" /> + <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="12.75" PointY="4.625" /> <AssociationConnector Association="RemoteModel.FK_EVENTS_ACTIONS_ACTIONS" /> <AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" /> <AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" /> |
