diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-05 20:33:02 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-05 20:33:02 +0200 |
| commit | 7e6c673cc8b04086fa3c78cd1bf5e31085fd8cc8 (patch) | |
| tree | c88947de8bdbea8c69e636ebcd8b8752cb61e870 /Software/Visual_Studio | |
| parent | 628819a1787290f84c22ecc7cb747f649fd54468 (diff) | |
| download | Tango-7e6c673cc8b04086fa3c78cd1bf5e31085fd8cc8.tar.gz Tango-7e6c673cc8b04086fa3c78cd1bf5e31085fd8cc8.zip | |
Working on color lab module !
Diffstat (limited to 'Software/Visual_Studio')
28 files changed, 1161 insertions, 155 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/arrow-long-down.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/arrow-long-down.png Binary files differnew file mode 100644 index 000000000..e3a862399 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/arrow-long-down.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/arrow-long-left.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/arrow-long-left.png Binary files differnew file mode 100644 index 000000000..5845204d2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/arrow-long-left.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/arrow-long-right.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/arrow-long-right.png Binary files differnew file mode 100644 index 000000000..6c089d44e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/arrow-long-right.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/data-table.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/data-table.png Binary files differnew file mode 100644 index 000000000..0d5e5eaa6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/data-table.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/transparent.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/transparent.jpg Binary files differnew file mode 100644 index 000000000..9ac68a6f5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/transparent.jpg diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj index 11a522b51..91bc51933 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj @@ -31,8 +31,42 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignColors, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> + </Reference> + <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="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath> + </Reference> <Reference Include="System.Xml" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Core" /> @@ -50,6 +84,11 @@ <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\CalibrationDataPointVM.cs" /> + <Compile Include="ViewModels\CalibrationDataVM.cs" /> + <Compile Include="ViewModels\LiquidVolumeVM.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> @@ -73,6 +112,8 @@ <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> + <None Include="app.config" /> + <None Include="packages.config" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> @@ -115,6 +156,10 @@ <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.MachineDesigner\Tango.MachineStudio.MachineDesigner.csproj"> + <Project>{d0ce8122-077d-42a2-9490-028ae4769b52}</Project> + <Name>Tango.MachineStudio.MachineDesigner</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Page Include="Views\MainView.xaml"> @@ -125,5 +170,16 @@ <ItemGroup> <Resource Include="Images\color-lab.jpg" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\data-table.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\transparent.jpg" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\arrow-long-down.png" /> + <Resource Include="Images\arrow-long-left.png" /> + <Resource Include="Images\arrow-long-right.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModelLocator.cs new file mode 100644 index 000000000..2ea8d17a3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModelLocator.cs @@ -0,0 +1,33 @@ +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Ioc; +using Microsoft.Practices.ServiceLocation; +using Tango.MachineStudio.ColorLab.ViewModels; +using Tango.MachineStudio.ColorLab.Views; + +namespace Tango.MachineStudio.ColorLab +{ + /// <summary> + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// </summary> + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + + SimpleIoc.Default.Register<MainViewVM>(); + } + + public static MainViewVM MainViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MainViewVM>(); + } + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataPointVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataPointVM.cs new file mode 100644 index 000000000..74f892a81 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataPointVM.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ColorLab.ViewModels +{ + public class CalibrationDataPointVM : ViewModel + { + private double _x; + + public double X + { + get { return _x; } + set { _x = value; RaisePropertyChangedAuto(); } + } + + private double _y; + + public double Y + { + get { return _y; } + set { _y = value; RaisePropertyChangedAuto(); } + } + + private int _index; + + public int Index + { + get { return _index; } + set { _index = value; RaisePropertyChangedAuto(); } + } + + + public CalibrationDataPointVM() + { + + } + + public CalibrationDataPointVM(double x, double y) + { + X = x; + Y = y; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataVM.cs new file mode 100644 index 000000000..1bcb29835 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataVM.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ColorLab.ViewModels +{ + public class CalibrationDataVM : ViewModel + { + private String _name; + + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); } + } + + private int _color; + + public int Color + { + get { return _color; } + set { _color = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<CalibrationDataPointVM> _calibrationPoints; + + public ObservableCollection<CalibrationDataPointVM> CalibrationPoints + { + get { return _calibrationPoints; } + set { _calibrationPoints = value; RaisePropertyChangedAuto(); OnCalibrationPointsChanged(); } + } + + private void OnCalibrationPointsChanged() + { + if (CalibrationPoints != null) + { + CalibrationPoints.CollectionChanged -= CalibrationPoints_CollectionChanged; + CalibrationPoints.CollectionChanged += CalibrationPoints_CollectionChanged; + + SetIndices(); + } + } + + private void CalibrationPoints_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + SetIndices(); + } + + private void SetIndices() + { + if (CalibrationPoints != null) + { + int index = 1; + foreach (var p in CalibrationPoints) + { + p.Index = index++; + } + } + } + + public CalibrationDataVM() + { + CalibrationPoints = new ObservableCollection<CalibrationDataPointVM>(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/LiquidVolumeVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/LiquidVolumeVM.cs new file mode 100644 index 000000000..a804d628b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/LiquidVolumeVM.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ColorLab.ViewModels +{ + public class LiquidVolumeVM : ViewModel + { + private String _name; + + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); } + } + + private double _volume; + + public double Volume + { + get { return _volume; } + set { _volume = value; RaisePropertyChangedAuto(); } + } + + private int _color; + + public int Color + { + get { return _color; } + set { _color = value; RaisePropertyChangedAuto(); } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..8260f000a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ColorLab.ViewModels +{ + public class MainViewVM : ViewModel + { + private ObservablesContext _dbContext; + + #region Properties + + private ObservableCollection<Machine> _machines; + /// <summary> + /// Gets or sets the machines. + /// </summary> + public ObservableCollection<Machine> Machines + { + get { return _machines; } + set { _machines = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<ColorSpace> _colorSpaces; + /// <summary> + /// Gets or sets the color spaces. + /// </summary> + public ObservableCollection<ColorSpace> ColorSpaces + { + get { return _colorSpaces; } + set { _colorSpaces = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<Rml> _rmls; + /// <summary> + /// Gets or sets the RMLS. + /// </summary> + public ObservableCollection<Rml> Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + + protected Machine _selectedMachine; + /// <summary> + /// Gets or sets the selected machine. + /// </summary> + public Machine SelectedMachine + { + get { return _selectedMachine; } + set + { + _selectedMachine = value; RaisePropertyChangedAuto(); + } + } + + private Rml _selectedRML; + /// <summary> + /// Gets or sets the selected RML. + /// </summary> + public Rml SelectedRML + { + get { return _selectedRML; } + set + { + _selectedRML = value; + InvalidateLiquidFactorsAndProcessTables(); + RaisePropertyChangedAuto(); + } + } + + private List<LiquidTypesRml> _liquidTypesRmls; + /// <summary> + /// Gets or sets the liquid types RMLS. + /// </summary> + public List<LiquidTypesRml> LiquidTypesRmls + { + get { return _liquidTypesRmls; } + set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<LiquidVolumeVM> _liquidVolumes; + + public ObservableCollection<LiquidVolumeVM> LiquidVolumes + { + get { return _liquidVolumes; } + set { _liquidVolumes = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<CalibrationDataVM> _liquidsCalibrationData; + + public ObservableCollection<CalibrationDataVM> LiquidsCalibrationData + { + get { return _liquidsCalibrationData; } + set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); } + } + + #endregion + + public MainViewVM() : base() + { + _dbContext = ObservablesContext.CreateDefault(); + + Machines = _dbContext.Machines.ToObservableCollection(); + ColorSpaces = _dbContext.ColorSpaces.ToObservableCollection(); + Rmls = _dbContext.Rmls.ToObservableCollection(); + } + + #region RML + + private void InvalidateLiquidFactorsAndProcessTables() + { + if (SelectedRML != null && SelectedMachine != null) + { + 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.ToList().SingleOrDefault(x => x.Active); + LiquidVolumes = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => new LiquidVolumeVM() { Color = x.LiquidType.Color, Name = x.LiquidType.Name }).ToObservableCollection(); + + LiquidsCalibrationData = new ObservableCollection<CalibrationDataVM>(); + + foreach (var liquidType in SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType)) + { + CalibrationDataVM vm = new CalibrationDataVM(); + vm.Name = liquidType.Name; + vm.Color = liquidType.Color; + + var cat = liquidType.Cats.FirstOrDefault(x => x.Machine == SelectedMachine); + + if (cat != null) + { + var calData = cat.GetCalibrationData(); + vm.CalibrationPoints = calData.CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection(); + } + + LiquidsCalibrationData.Add(vm); + } + } + } + + #endregion + + #region Override Methods + + protected override void RaisePropertyChangedAuto([CallerMemberName] string caller = null) + { + base.RaisePropertyChangedAuto(caller); + InvalidateRelayCommands(); + } + + #endregion + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml index a2bb7f1f2..92ef15231 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml @@ -3,10 +3,379 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" + xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.ColorLab.ViewModels" + xmlns:brushPicker="clr-namespace:Tango.BrushPicker;assembly=Tango.BrushPicker" + xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner" + xmlns:global="clr-namespace:Tango.MachineStudio.ColorLab" xmlns:local="clr-namespace:Tango.MachineStudio.ColorLab.Views" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + <converters:ColorComponentToOpacityConverter x:Key="ColorComponentToOpacityConverter" /> + <converters:ColorToComponentsConverter x:Key="ColorToComponentsConverter" /> + </UserControl.Resources> + <Grid> - + <Grid.ColumnDefinitions> + <ColumnDefinition Width="500"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid Background="#B1FFFFFF"> + <StackPanel> + <TextBlock Margin="40 20" FontSize="30" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> + <ComboBox ItemsSource="{Binding Machines}" FontSize="20" SelectedItem="{Binding SelectedMachine}" materialDesign:HintAssist.Hint="Serial Number" Margin="40 0 40 0"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + <designer:MachineView Width="500" IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> + <StackPanel Margin="40 40"> + <TextBlock FontSize="16">MEDIA</TextBlock> + <ComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" FontSize="16"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding Name}" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <TextBlock FontSize="11" Text="{Binding Manufacturer}" Foreground="Gray"></TextBlock> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + + + <TextBlock FontSize="16" Margin="0 40 0 0">LIQUID FACTORS</TextBlock> + <ItemsControl ItemsSource="{Binding LiquidTypesRmls}" Margin="0 10 0 0"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel IsItemsHost="True"></WrapPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> + <StackPanel Margin="0 0 10 0"> + <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidType.Name}"></TextBlock> + <Grid Width="58" Height="48" Margin="0 5 0 0"> + <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> + <shapes:Hexagon.Fill> + <LinearGradientBrush Opacity="0.7" > + <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Color="White" Offset="1"/> + </LinearGradientBrush> + </shapes:Hexagon.Fill> + </shapes:Hexagon> + + <TextBox Style="{x:Null}" Background="Transparent" Foreground="Black" BorderThickness="0" Text="{Binding MaxNlPerCm}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" FontStyle="Italic"></TextBox> + </Grid> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + </StackPanel> + </Grid> + + <Grid Grid.Column="1"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="200" /> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <Grid> + <Grid Margin="10"> + <StackPanel HorizontalAlignment="Center"> + <TextBlock FontSize="20" TextAlignment="Center">COLOR ADJUSTMENT DATA</TextBlock> + + <UniformGrid Columns="2" Margin="0 10 0 0"> + <Grid Margin="0 0 100 0"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ArrowLeftBoldHexagonOutline" VerticalAlignment="Center" Width="70" Height="70" /> + <Image Source="../Images/data-table.png" Width="128" Opacity="0.8"></Image> + <StackPanel VerticalAlignment="Center" Width="200" Margin="10 0 0 0"> + <TextBlock FontSize="16" FontStyle="Italic" FontWeight="SemiBold">Inverse Data</TextBlock> + <TextBox IsReadOnly="False" Margin="0 5 0 0"></TextBox> + <UniformGrid Columns="2" Margin="0 5 0 0"> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Upload" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">IMPORT</TextBlock> + </StackPanel> + </Button> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Download" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">EXPORT</TextBlock> + </StackPanel> + </Button> + </UniformGrid> + </StackPanel> + </StackPanel> + </Grid> + <Grid Margin="100 0 0 0"> + <StackPanel Orientation="Horizontal"> + <StackPanel VerticalAlignment="Center" Width="200" Margin="0 0 10 0"> + <TextBlock FontSize="16" FontStyle="Italic" FontWeight="SemiBold" HorizontalAlignment="Right">Forward Data</TextBlock> + <TextBox IsReadOnly="False" Margin="0 5 0 0"></TextBox> + <UniformGrid Columns="2" Margin="0 5 0 0"> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Upload" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">IMPORT</TextBlock> + </StackPanel> + </Button> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Download" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">EXPORT</TextBlock> + </StackPanel> + </Button> + </UniformGrid> + </StackPanel> + <Image Source="../Images/data-table.png" Width="128" RenderTransformOrigin="0.5,0.5" Opacity="0.8"> + <Image.RenderTransform> + <ScaleTransform ScaleY="1" ScaleX="-1" /> + </Image.RenderTransform> + </Image> + <materialDesign:PackIcon Kind="ArrowRightBoldHexagonOutline" VerticalAlignment="Center" Width="70" Height="70" /> + </StackPanel> + </Grid> + </UniformGrid> + </StackPanel> + </Grid> + + <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle> + </Grid> + + <Grid Grid.Row="1" Margin="0 40 0 0" HorizontalAlignment="Center"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="300" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="300" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="1*" /> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="20" /> + <RowDefinition/> + <RowDefinition Height="30" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <StackPanel VerticalAlignment="Center" Grid.Row="1"> + <Border BorderThickness="1" BorderBrush="#545454" Margin="0" Padding="2 2 2 0"> + <brushPicker:BrushPicker x:Name="picker" Background="Transparent" BorderThickness="0" Height="150" BrushTypeVisibility="Collapsed"> + <brushPicker:BrushPicker.Color> + <MultiBinding Converter="{StaticResource ColorToComponentsConverter}" Mode="TwoWay"> + <Binding ElementName="sliderR" Path="Value" Mode="TwoWay"></Binding> + <Binding ElementName="sliderG" Path="Value" Mode="TwoWay"></Binding> + <Binding ElementName="sliderB" Path="Value" Mode="TwoWay"></Binding> + </MultiBinding> + </brushPicker:BrushPicker.Color> + </brushPicker:BrushPicker> + </Border> + + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="R" VerticalAlignment="Center" /> + <TextBlock DockPanel.Dock="Right" Text="{Binding ElementName=picker,Path=Color.R}"></TextBlock> + <Slider x:Name="sliderR" Margin="10 0" Maximum="255"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="G" VerticalAlignment="Center" /> + <TextBlock DockPanel.Dock="Right" Text="{Binding ElementName=picker,Path=Color.G}"></TextBlock> + <Slider x:Name="sliderG" Margin="10 0" Maximum="255"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="B" VerticalAlignment="Center" /> + <TextBlock DockPanel.Dock="Right" Text="{Binding ElementName=picker,Path=Color.B}"></TextBlock> + <Slider x:Name="sliderB" Margin="10 0" Maximum="255"></Slider> + </DockPanel> + </StackPanel> + + <TextBlock FontStyle="Italic" HorizontalAlignment="Center">SOURCE / INVERSE RGB</TextBlock> + <TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="2">SUGGESTIONS</TextBlock> + <TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="4">LIQUID VOLUMES</TextBlock> + + <Image Source="../Images/arrow-long-right.png" Grid.Column="1" Grid.Row="1" Width="140" Opacity="0.8" Margin="20 0 0 0"></Image> + + <controls:HiveControl Width="200" Height="200" Grid.Column="2" Grid.Row="1" /> + + <Image Source="../Images/arrow-long-right.png" Grid.Column="3" Grid.Row="1" Width="140" Opacity="0.8" Margin="0 0 20 0"></Image> + + <Grid Grid.Column="4" Grid.Row="1"> + <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="420" > + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding Name}" FontSize="10" Margin="0 0 0 5"></TextBlock> + <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> + <ContentControl.Foreground> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </ContentControl.Foreground> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <!--<mahapps:NumericUpDown.Resources> + <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> + </mahapps:NumericUpDown.Resources>--> + </mahapps:NumericUpDown> + </ContentControl> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <Image Source="../Images/arrow-long-down.png" Grid.Column="1" Grid.Row="1" Margin="0 0 10 -170" Height="70" Width="40" Opacity="0.8" Stretch="Fill" HorizontalAlignment="Right" ></Image> + </Grid> + + + <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="420" Grid.Column="4" Grid.Row="3"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding Name}" FontSize="10" Margin="0 0 0 5"></TextBlock> + <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> + <ContentControl.Foreground> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </ContentControl.Foreground> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <!--<mahapps:NumericUpDown.Resources> + <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> + </mahapps:NumericUpDown.Resources>--> + </mahapps:NumericUpDown> + </ContentControl> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + + <Image Source="../Images/arrow-long-Left.png" Grid.Column="2" Grid.Row="3" Width="140" Opacity="0.8"></Image> + + <Border BorderBrush="Silver" Grid.Row="3"> + <Grid> + <DockPanel Width="80" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">COMPOSITE</TextBlock> + <Ellipse Height="70" Margin="0 5 0 0" Stroke="#202020"> + <Ellipse.Fill> + <SolidColorBrush Color="{Binding ElementName=picker,Path=Color}"></SolidColorBrush> + </Ellipse.Fill> + </Ellipse> + </DockPanel> + + <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Height="60"> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">R</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"> + <Rectangle.Fill> + <SolidColorBrush Color="Red" Opacity="{Binding ElementName=picker,Path=Color.R,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding ElementName=picker,Path=Color.R}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">G</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"> + <Rectangle.Fill> + <SolidColorBrush Color="Green" Opacity="{Binding ElementName=picker,Path=Color.G,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding ElementName=picker,Path=Color.G}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">B</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"> + <Rectangle.Fill> + <SolidColorBrush Color="Blue" Opacity="{Binding ElementName=picker,Path=Color.B,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding ElementName=picker,Path=Color.B}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + </StackPanel> + </Grid> + </Border> + </Grid> + </Grid> + + <Grid Grid.Row="2" Margin="0 20 0 0"> + <Rectangle VerticalAlignment="Top" Stroke="Silver"></Rectangle> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <TextBlock FontSize="20" Margin="0 20 0 0" TextAlignment="Center">CALIBRATION DATA</TextBlock> + </Grid> + + <Grid Margin="0 20 0 0"> + <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding LiquidsCalibrationData}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Rows="1" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + + <ItemsControl.ItemTemplate> + <DataTemplate> + <DockPanel> + <Border Padding="2" Margin="5" CornerRadius="3" DockPanel.Dock="Top"> + <Border.Background> + <SolidColorBrush Opacity="0.4" Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </Border.Background> + <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" Foreground="Black"></TextBlock> + </Border> + + <Grid> + <DataGrid Background="#BBFFFFFF" AlternatingRowBackground="#CCE1E1E1" BorderThickness="1" BorderBrush="#202020" Margin="5 0" ItemsSource="{Binding CalibrationPoints}" CanUserResizeColumns="False" CanUserReorderColumns="False" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" CanUserSortColumns="True"> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="FlowDirection" Value="RightToLeft"></Setter> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTextColumn Header="#" Binding="{Binding Index}" Width="Auto" IsReadOnly="True" Foreground="DimGray" FontSize="11" /> + <mahapps:DataGridNumericUpDownColumn Header="X" Binding="{Binding X}" Minimum="0" Maximum="10000" HideUpDownButtons="True" Width="1*"/> + <mahapps:DataGridNumericUpDownColumn Header="Y" Binding="{Binding Y}" Minimum="0" Maximum="10000" HideUpDownButtons="True" Width="1*" /> + </DataGrid.Columns> + </DataGrid> + </Grid> + </DockPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Grid> + </DockPanel> + </Grid> + </Grid> + </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/app.config new file mode 100644 index 000000000..4a6cb0526 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/app.config @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/packages.config new file mode 100644 index 000000000..8cd12859b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/packages.config @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> + <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> + <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> + <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" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.BL/Entities/Cat.cs b/Software/Visual_Studio/Tango.BL/Entities/Cat.cs index 69b1cab18..8af866549 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Cat.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Cat.cs @@ -34,23 +34,23 @@ namespace Tango.BL.Entities } - protected String _liquidtypeguid; + protected String _machineguid; /// <summary> - /// Gets or sets the cat liquid type guid. + /// Gets or sets the cat machine guid. /// </summary> - [Column("LIQUID_TYPE_GUID")] - [ForeignKey("LiquidType")] + [Column("MACHINE_GUID")] + [ForeignKey("Machine")] - public String LiquidTypeGuid + public String MachineGuid { get { - return _liquidtypeguid; + return _machineguid; } set { - _liquidtypeguid = value; RaisePropertyChanged(nameof(LiquidTypeGuid)); + _machineguid = value; RaisePropertyChanged(nameof(MachineGuid)); } } @@ -76,6 +76,27 @@ namespace Tango.BL.Entities } + protected String _liquidtypeguid; + /// <summary> + /// Gets or sets the cat liquid type guid. + /// </summary> + [Column("LIQUID_TYPE_GUID")] + [ForeignKey("LiquidType")] + + public String LiquidTypeGuid + { + get + { + return _liquidtypeguid; + } + + set + { + _liquidtypeguid = value; RaisePropertyChanged(nameof(LiquidTypeGuid)); + } + + } + protected Byte[] _data; /// <summary> /// Gets or sets the cat data. @@ -117,6 +138,27 @@ namespace Tango.BL.Entities } + protected Machine _machine; + /// <summary> + /// Gets or sets the cat machine. + /// </summary> + + [XmlIgnore] + [JsonIgnore] + public virtual Machine Machine + { + get + { + return _machine; + } + + set + { + _machine = value; RaisePropertyChanged(nameof(Machine)); + } + + } + protected Rml _rml; /// <summary> /// Gets or sets the cat rml. diff --git a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs index a704f47f0..f92d7bcdd 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs @@ -137,6 +137,25 @@ namespace Tango.BL.Entities } + protected ObservableCollection<Cat> _cats; + /// <summary> + /// Gets or sets the machine cats. + /// </summary> + + public virtual ObservableCollection<Cat> Cats + { + get + { + return _cats; + } + + set + { + _cats = value; RaisePropertyChanged(nameof(Cats)); + } + + } + protected Configuration _configuration; /// <summary> /// Gets or sets the machine configuration. @@ -263,6 +282,8 @@ namespace Tango.BL.Entities public Machine() : base() { + Cats = new ObservableCollection<Cat>(); + Jobs = new ObservableCollection<Job>(); MachinesConfigurations = new ObservableCollection<MachinesConfiguration>(); diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs index f265657ec..aa64cebcb 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs @@ -11,6 +11,7 @@ namespace Tango.BL { public partial class ObservablesContext : DbContext { + /// <summary> /// Gets or sets the ActionTypes. /// </summary> diff --git a/Software/Visual_Studio/Tango.BrushPicker/Implementation/BrushPicker.cs b/Software/Visual_Studio/Tango.BrushPicker/Implementation/BrushPicker.cs index b94db6298..5c834dcdf 100644 --- a/Software/Visual_Studio/Tango.BrushPicker/Implementation/BrushPicker.cs +++ b/Software/Visual_Studio/Tango.BrushPicker/Implementation/BrushPicker.cs @@ -63,7 +63,7 @@ namespace Tango.BrushPicker this.CommandBindings.Add(new CommandBinding(BrushPicker.RemoveGradientStop, RemoveGradientStop_Executed)); this.CommandBindings.Add(new CommandBinding(BrushPicker.ReverseGradientStop, ReverseGradientStop_Executed)); - BrushType = BrushTypes.Linear; + BrushType = BrushTypes.Solid; } void CurrentColorTextBox_PreviewKeyDown(object sender, KeyEventArgs e) @@ -395,11 +395,24 @@ namespace Tango.BrushPicker c.SetBrush(); } } - + #endregion #region Public Properties + + + public Visibility BrushTypeVisibility + { + get { return (Visibility)GetValue(BrushTypeVisibilityProperty); } + set { SetValue(BrushTypeVisibilityProperty, value); } + } + public static readonly DependencyProperty BrushTypeVisibilityProperty = + DependencyProperty.Register("BrushTypeVisibility", typeof(Visibility), typeof(BrushPicker), new PropertyMetadata(Visibility.Visible)); + + + + public IEnumerable<Enum> SpreadMethodTypes { get diff --git a/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml b/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml index 5a5d7e843..5b1bcbbc3 100644 --- a/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml @@ -8,7 +8,7 @@ License (Ms-PL) as published at http://colorbox.codeplex.com/license *********************************************************************************** --> - + <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Tango.BrushPicker"> @@ -40,7 +40,7 @@ </Grid> </VisualBrush.Visual> </VisualBrush> - + <Style TargetType="Path" x:Key="IconStyle"> <Setter Property="Height" Value="16"/> <Setter Property="Width" Value="16"/> @@ -54,8 +54,8 @@ <Setter Property="Margin" Value="2"/> <Setter Property="Minimum" Value="0"/> <Setter Property="Maximum" Value="1"/> - </Style> - + </Style> + <!-- Gradient Stop Thumb Style --> <Style x:Key="SliderThumbStyle" TargetType="Thumb"> <Setter Property="SnapsToDevicePixels" Value="True" /> @@ -95,7 +95,7 @@ </Style> - + <!-- ******* DoubleUpDown ******* --> <Style x:Key="NumericUpDown" TargetType="{x:Type local:UpDownBase}"> @@ -163,9 +163,9 @@ </Setter> </Style> - + <!-- ******* ColorBox ******* --> - <Style TargetType="{x:Type local:BrushPicker}"> + <Style TargetType="{x:Type local:BrushPicker}"> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="Background" Value="#E7E8E8" /> @@ -173,7 +173,7 @@ <Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="Template"> <Setter.Value> - <ControlTemplate TargetType="{x:Type local:BrushPicker}"> + <ControlTemplate TargetType="{x:Type local:BrushPicker}"> <Border x:Name="PART_Root" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" @@ -182,16 +182,23 @@ <KeyBinding Key="Delete" Command="{x:Static local:BrushPicker.RemoveGradientStop}"/> </Border.InputBindings> - <StackPanel Margin="5"> + <Grid Margin="5"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> - <StackPanel.Resources> + <Grid.Resources> <Style x:Key="TBStyle" TargetType="TextBlock"> <Setter Property="Margin" Value="2"/> <Setter Property="VerticalAlignment" Value="Center"/> </Style> - </StackPanel.Resources> - - <ListBox x:Name="listAvailableBrushType" + </Grid.Resources> + + <ListBox x:Name="listAvailableBrushType" Height="30" Visibility="{TemplateBinding BrushTypeVisibility}" HorizontalContentAlignment="Center" SelectedItem="{Binding BrushType, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" ItemsSource="{Binding AvailableBrushTypes, RelativeSource={RelativeSource TemplatedParent}}"> @@ -263,62 +270,54 @@ </ListBox.ItemContainerStyle> </ListBox> - - <ScrollViewer Margin="0,5,0,5" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" > - <ScrollViewer.Style> - <Style TargetType="ScrollViewer"> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=listAvailableBrushType, Path=SelectedValue}" Value="None"> - <Setter Property="Visibility" Value="Collapsed"/> - </DataTrigger> - </Style.Triggers> - </Style> - </ScrollViewer.Style> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*" /> - <ColumnDefinition Width="5" /> - <ColumnDefinition Width="20" /> - <ColumnDefinition Width="5" /> - <!--<ColumnDefinition Width="20" />--> - </Grid.ColumnDefinitions> + <Grid Margin="0,5,0,5" Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="5" /> + <ColumnDefinition Width="20" /> + <ColumnDefinition Width="5" /> + <!--<ColumnDefinition Width="20" />--> + </Grid.ColumnDefinitions> - <!-- saturation / brightness selector --> - <Grid Grid.Column="0" ClipToBounds="true"> - <local:SaturationBrightnessSelector x:Name="SV" MinHeight="128" + <!-- saturation / brightness selector --> + <Grid Grid.Column="0" ClipToBounds="true"> + + <Border BorderThickness="1" BorderBrush="DimGray"> + <local:SaturationBrightnessSelector x:Name="SV" MinHeight="0" Saturation="{Binding Path=Saturation,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" Brightness="{Binding Path=Brightness,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" Hue="{Binding ElementName=H,Path=Hue}"/> + </Border> - <Grid VerticalAlignment="Top" HorizontalAlignment="Left" Margin="-6,-6,0,0" Width="12" Height="12" > - <Ellipse Stroke="#000000" /> - <Ellipse Stroke="#FFFFFF" Margin="1" /> - <Grid.RenderTransform> - <TranslateTransform X="{Binding ElementName=SV,Path=SaturationOffset}" Y="{Binding ElementName=SV,Path=BrightnessOffset}" /> - </Grid.RenderTransform> - </Grid> + <Grid VerticalAlignment="Top" HorizontalAlignment="Left" Margin="-6,-6,0,0" Width="12" Height="12" > + <Ellipse Stroke="#000000" /> + <Ellipse Stroke="#FFFFFF" Margin="1" /> + <Grid.RenderTransform> + <TranslateTransform X="{Binding ElementName=SV,Path=SaturationOffset}" Y="{Binding ElementName=SV,Path=BrightnessOffset}" /> + </Grid.RenderTransform> </Grid> + </Grid> - <!-- hue selector --> - <local:HueSelector x:Name="H" Grid.Column="2" + <!-- hue selector --> + <local:HueSelector x:Name="H" Grid.Column="2" Hue="{Binding Path=Hue,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" /> - <Path Grid.Column="2" HorizontalAlignment="Left" Margin="0,-5,0,5" Stroke="#FFFFFF" Fill="#000000" Data="M 0 0 L 7 5 L 0 10Z"> - <Path.RenderTransform> - <TranslateTransform Y="{Binding ElementName=H,Path=HueOffset}" /> - </Path.RenderTransform> - </Path> - <Path Grid.Column="2" HorizontalAlignment="Right" Margin="0,-5,0,5" Stroke="#FFFFFF" Fill="#000000" Data="M 0 5 L 7 0 L 7 10 Z"> - <Path.RenderTransform> - <TranslateTransform Y="{Binding ElementName=H,Path=HueOffset}" /> - </Path.RenderTransform> - </Path> + <Path Grid.Column="2" HorizontalAlignment="Left" Margin="0,-5,0,5" Stroke="#FFFFFF" Fill="#000000" Data="M 0 0 L 7 5 L 0 10Z"> + <Path.RenderTransform> + <TranslateTransform Y="{Binding ElementName=H,Path=HueOffset}" /> + </Path.RenderTransform> + </Path> + <Path Grid.Column="2" HorizontalAlignment="Right" Margin="0,-5,0,5" Stroke="#FFFFFF" Fill="#000000" Data="M 0 5 L 7 0 L 7 10 Z"> + <Path.RenderTransform> + <TranslateTransform Y="{Binding ElementName=H,Path=HueOffset}" /> + </Path.RenderTransform> + </Path> - <!-- alpha selector --> - <!--<Rectangle Grid.Column="4" Fill="{StaticResource AlphaBrush}" /> + <!-- alpha selector --> + <!--<Rectangle Grid.Column="4" Fill="{StaticResource AlphaBrush}" /> <local:AlphaSelector x:Name="A" Grid.Column="4" Alpha="{Binding Path=Alpha,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" />--> - <!--<Path Grid.Column="4" HorizontalAlignment="Left" Margin="0,-5,0,5" Stroke="#FFFFFF" Fill="#000000" Data="M 0 0 L 7 5 L 0 10Z"> + <!--<Path Grid.Column="4" HorizontalAlignment="Left" Margin="0,-5,0,5" Stroke="#FFFFFF" Fill="#000000" Data="M 0 0 L 7 5 L 0 10Z"> <Path.RenderTransform> <TranslateTransform Y="{Binding ElementName=A,Path=AlphaOffset}" /> </Path.RenderTransform> @@ -328,10 +327,9 @@ <TranslateTransform Y="{Binding ElementName=A,Path=AlphaOffset}" /> </Path.RenderTransform> </Path>--> - </Grid> - </ScrollViewer> - - <Grid Height="20"> + </Grid> + + <Grid Height="20" Grid.Row="2"> <!-- Hide when brush type is None --> <Grid.Style> @@ -356,7 +354,7 @@ </Rectangle.Fill> </Rectangle> - <TextBox x:Name="PART_CurrentColor" + <TextBox x:Name="PART_CurrentColor" Visibility="Collapsed" Text="{Binding Color, RelativeSource={RelativeSource TemplatedParent}}" local:TextBoxBehavior.SelectAllTextOnFocus="True" Grid.Column="2" MinWidth="100" > @@ -378,8 +376,8 @@ </TextBox> </Grid> - - <Grid Margin="0,5,0,0" Focusable="False"> + + <Grid Margin="0,5,0,0" Focusable="False" Grid.Row="3"> <Grid.Style> <Style TargetType="Grid"> @@ -523,8 +521,8 @@ </Button>--> </Grid> - - <StackPanel Margin="0,5,0,0"> + + <StackPanel Margin="0,5,0,0" Grid.Row="4"> <StackPanel.Style> <Style TargetType="StackPanel"> <Style.Triggers> @@ -696,7 +694,7 @@ </StackPanel> </StackPanel> - </StackPanel> + </Grid> </Border> </ControlTemplate> </Setter.Value> diff --git a/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs index 3d0532985..6e7e03729 100644 --- a/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs +++ b/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs @@ -47,5 +47,15 @@ namespace Tango.Core.Helpers { return Color.FromRgb((byte)rnd.Next(256), (byte)rnd.Next(256), (byte)rnd.Next(256)); } + + /// <summary> + /// Returns a random color. + /// </summary> + /// <returns></returns> + public static Color GetRandomGrayscaleColor() + { + var value = (byte)rnd.Next(0, 220); + return Color.FromRgb(value, value, value); + } } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/CAT.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/CAT.cs index f016853a4..cd980e815 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/CAT.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/CAT.cs @@ -18,11 +18,13 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public string NAME { get; set; } - public string LIQUID_TYPE_GUID { get; set; } + public string MACHINE_GUID { get; set; } public string RML_GUID { get; set; } + public string LIQUID_TYPE_GUID { get; set; } public byte[] DATA { get; set; } public virtual LIQUID_TYPES LIQUID_TYPES { get; set; } + public virtual MACHINE MACHINE { get; set; } public virtual RML RML { get; set; } } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs index 7da6d4f2f..0c2c0b37c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs @@ -17,6 +17,7 @@ namespace Tango.DAL.Remote.DB [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public MACHINE() { + this.CATS = new HashSet<CAT>(); this.JOBS = new HashSet<JOB>(); this.MACHINES_CONFIGURATIONS = new HashSet<MACHINES_CONFIGURATIONS>(); this.MACHINES_EVENTS = new HashSet<MACHINES_EVENTS>(); @@ -32,6 +33,8 @@ namespace Tango.DAL.Remote.DB public string MACHINE_VERSION_GUID { get; set; } public string CONFIGURATION_GUID { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection<CAT> CATS { get; set; } public virtual CONFIGURATION CONFIGURATION { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<JOB> JOBS { 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 7f913ba59..17c9fc49d 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -122,8 +122,9 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime2" Precision="3" Nullable="false" /> <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> - <Property Name="LIQUID_TYPE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="MACHINE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="RML_GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="LIQUID_TYPE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="DATA" Type="image" Nullable="false" /> </EntityType> <EntityType Name="CCTS"> @@ -932,7 +933,9 @@ </ReferentialConstraint> </Association> <Association Name="FK_CATS_LIQUID_TYPES1"> - <End Role="LIQUID_TYPES" Type="Self.LIQUID_TYPES" Multiplicity="1" /> + <End Role="LIQUID_TYPES" Type="Self.LIQUID_TYPES" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Role="CATS" Type="Self.CATS" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="LIQUID_TYPES"> @@ -943,8 +946,24 @@ </Dependent> </ReferentialConstraint> </Association> + <Association Name="FK_CATS_MACHINES"> + <End Role="MACHINES" Type="Self.MACHINES" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> + <End Role="CATS" Type="Self.CATS" Multiplicity="*" /> + <ReferentialConstraint> + <Principal Role="MACHINES"> + <PropertyRef Name="GUID" /> + </Principal> + <Dependent Role="CATS"> + <PropertyRef Name="MACHINE_GUID" /> + </Dependent> + </ReferentialConstraint> + </Association> <Association Name="FK_CATS_RMLS"> - <End Role="RMLS" Type="Self.RMLS" Multiplicity="1" /> + <End Role="RMLS" Type="Self.RMLS" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Role="CATS" Type="Self.CATS" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="RMLS"> @@ -956,7 +975,9 @@ </ReferentialConstraint> </Association> <Association Name="FK_CCTS_RMLS"> - <End Role="RMLS" Type="Self.RMLS" Multiplicity="1" /> + <End Role="RMLS" Type="Self.RMLS" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Role="CCTS" Type="Self.CCTS" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="RMLS"> @@ -1824,6 +1845,10 @@ <End Role="LIQUID_TYPES" EntitySet="LIQUID_TYPES" /> <End Role="CATS" EntitySet="CATS" /> </AssociationSet> + <AssociationSet Name="FK_CATS_MACHINES" Association="Self.FK_CATS_MACHINES"> + <End Role="MACHINES" EntitySet="MACHINES" /> + <End Role="CATS" EntitySet="CATS" /> + </AssociationSet> <AssociationSet Name="FK_CATS_RMLS" Association="Self.FK_CATS_RMLS"> <End Role="RMLS" EntitySet="RMLS" /> <End Role="CATS" EntitySet="CATS" /> @@ -2196,6 +2221,10 @@ <End Role="LIQUID_TYPES" EntitySet="LIQUID_TYPES" /> <End Role="CAT" EntitySet="CATS" /> </AssociationSet> + <AssociationSet Name="FK_CATS_MACHINES" Association="RemoteModel.FK_CATS_MACHINES"> + <End Role="MACHINE" EntitySet="MACHINES" /> + <End Role="CAT" EntitySet="CATS" /> + </AssociationSet> <AssociationSet Name="FK_CATS_RMLS" Association="RemoteModel.FK_CATS_RMLS"> <End Role="RML" EntitySet="RMLS" /> <End Role="CAT" EntitySet="CATS" /> @@ -2545,10 +2574,12 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> - <Property Name="LIQUID_TYPE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <Property Name="MACHINE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="RML_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <Property Name="LIQUID_TYPE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="DATA" Type="Binary" Nullable="false" MaxLength="Max" FixedLength="false" /> <NavigationProperty Name="LIQUID_TYPES" Relationship="RemoteModel.FK_CATS_LIQUID_TYPES1" FromRole="CAT" ToRole="LIQUID_TYPES" /> + <NavigationProperty Name="MACHINE" Relationship="RemoteModel.FK_CATS_MACHINES" FromRole="CAT" ToRole="MACHINE" /> <NavigationProperty Name="RML" Relationship="RemoteModel.FK_CATS_RMLS" FromRole="CAT" ToRole="RML" /> </EntityType> <EntityType Name="CCT"> @@ -3054,6 +3085,7 @@ <Property Name="ORGANIZATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="MACHINE_VERSION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="CONFIGURATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <NavigationProperty Name="CATS" Relationship="RemoteModel.FK_CATS_MACHINES" FromRole="MACHINE" ToRole="CAT" /> <NavigationProperty Name="CONFIGURATION" Relationship="RemoteModel.FK_MACHINES_CONFIGURATIONS" FromRole="MACHINE" ToRole="CONFIGURATION" /> <NavigationProperty Name="JOBS" Relationship="RemoteModel.FK_JOBS_MACHINES" FromRole="MACHINE" ToRole="JOB" /> <NavigationProperty Name="MACHINE_VERSIONS" Relationship="RemoteModel.FK_MACHINES_MACHINE_VERSIONS" FromRole="MACHINE" ToRole="MACHINE_VERSIONS" /> @@ -3576,7 +3608,9 @@ </ReferentialConstraint> </Association> <Association Name="FK_CATS_LIQUID_TYPES1"> - <End Type="RemoteModel.LIQUID_TYPES" Role="LIQUID_TYPES" Multiplicity="1" /> + <End Type="RemoteModel.LIQUID_TYPES" Role="LIQUID_TYPES" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Type="RemoteModel.CAT" Role="CAT" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="LIQUID_TYPES"> @@ -3587,8 +3621,24 @@ </Dependent> </ReferentialConstraint> </Association> + <Association Name="FK_CATS_MACHINES"> + <End Type="RemoteModel.MACHINE" Role="MACHINE" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> + <End Type="RemoteModel.CAT" Role="CAT" Multiplicity="*" /> + <ReferentialConstraint> + <Principal Role="MACHINE"> + <PropertyRef Name="GUID" /> + </Principal> + <Dependent Role="CAT"> + <PropertyRef Name="MACHINE_GUID" /> + </Dependent> + </ReferentialConstraint> + </Association> <Association Name="FK_CATS_RMLS"> - <End Type="RemoteModel.RML" Role="RML" Multiplicity="1" /> + <End Type="RemoteModel.RML" Role="RML" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Type="RemoteModel.CAT" Role="CAT" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="RML"> @@ -3600,7 +3650,9 @@ </ReferentialConstraint> </Association> <Association Name="FK_CCTS_RMLS"> - <End Type="RemoteModel.RML" Role="RML" Multiplicity="1" /> + <End Type="RemoteModel.RML" Role="RML" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Type="RemoteModel.CCT" Role="CCT" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="RML"> @@ -4414,8 +4466,9 @@ <EntityTypeMapping TypeName="RemoteModel.CAT"> <MappingFragment StoreEntitySet="CATS"> <ScalarProperty Name="DATA" ColumnName="DATA" /> - <ScalarProperty Name="RML_GUID" ColumnName="RML_GUID" /> <ScalarProperty Name="LIQUID_TYPE_GUID" ColumnName="LIQUID_TYPE_GUID" /> + <ScalarProperty Name="RML_GUID" ColumnName="RML_GUID" /> + <ScalarProperty Name="MACHINE_GUID" ColumnName="MACHINE_GUID" /> <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="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 086143a4d..5301bbb1f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,72 +5,72 @@ <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1"> - <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="7" PointY="83.625" /> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="74.875" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="1.5" PointY="67.875" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="62" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="1.5" PointY="53.25" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="1.5" PointY="64.875" /> - <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="12.75" PointY="15.375" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="6.75" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="5.25" PointY="15.75" /> - <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="32.375" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="10.5" PointY="6.75" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="8.25" PointY="8.5" /> - <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3.75" PointY="57" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="70.75" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="6.75" PointY="73.75" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="59.125" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="56.125" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="7" PointY="79.5" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="9.25" PointY="79.625" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="25.25" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="22.375" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="4.5" PointY="65.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="6.75" PointY="54.375" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="4.5" PointY="53.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="6.75" PointY="48.5" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="7.5" PointY="65.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="9.75" PointY="48.5" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="49.5" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="1.5" PointY="45.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="3.75" PointY="49.75" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="6.75" PointY="4.5" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="9" PointY="33.375" /> - <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="10.5" PointY="14" /> - <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="8.25" PointY="13.875" /> - <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="16" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="8.625" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="5.25" PointY="11.75" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="8.25" PointY="42.125" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3.75" PointY="46.25" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="6" PointY="60.375" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="8.25" PointY="59.5" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="9.25" PointY="55.25" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="19.625" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="8.75" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="11.75" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="28.25" /> - <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="6.75" PointY="70.625" /> - <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3.75" PointY="73.125" /> - <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="9" PointY="3.25" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="26.375" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="27.625" /> - <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="13.25" /> - <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="9" PointY="22.125" /> - <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="11.25" PointY="23.25" /> - <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="10.5" PointY="17.375" /> - <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="6" PointY="37.25" /> - <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="0.75" PointY="2.125" /> - <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="2.75" PointY="2.125" /> - <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="0.75" PointY="5.125" /> - <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="11.75" PointY="2.125" /> - <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="12.75" PointY="6.125" /> - <EntityTypeShape EntityType="RemoteModel.TECH_MOTORS" Width="1.5" PointX="2.75" PointY="5.125" /> - <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="12.75" PointY="11.125" /> - <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="6" PointY="41.375" /> - <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="11.25" PointY="42.125" /> - <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="6" PointY="20.25" /> + <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="8" PointY="6.25" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="3.5" PointY="43.25" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="3.5" PointY="65.75" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="3.5" PointY="47.5" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="3.5" PointY="50.375" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="3.5" PointY="59.875" /> + <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="14.75" PointY="9.625" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="5.75" PointY="32.625" /> + <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="8.25" PointY="19.125" /> + <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="26.125" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="12.5" PointY="4" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="10.25" PointY="5.75" /> + <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="5.75" PointY="55" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="3.5" PointY="39.125" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="5.75" PointY="6.75" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="3.5" PointY="57" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="3.5" PointY="62.875" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="8" PointY="36.125" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="10.25" PointY="35.25" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="28.75" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="25.875" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="3.5" PointY="35.625" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="5.75" PointY="50.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="8.5" PointY="46.625" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="10.75" PointY="49.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="9.5" PointY="59.625" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="11.75" PointY="55.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="3.5" PointY="53.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="6.5" PointY="61.625" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="8.75" PointY="55.5" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="5.75" PointY="45.25" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="8" PointY="39.625" /> + <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="12.5" PointY="15.125" /> + <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="10.25" PointY="11.5" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="16.625" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="23.125" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="5.25" PointY="18.375" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="10.25" PointY="31" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="5.75" PointY="35.75" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="8" PointY="49.875" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="13.25" PointY="52" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="10.25" PointY="38.875" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="23.125" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="9.375" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="12.25" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="20.25" /> + <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="5.75" PointY="65.5" /> + <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="5.75" PointY="41.5" /> + <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="13" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="13" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="14.25" /> + <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="13.75" /> + <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="8" PointY="9.625" /> + <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="15.25" PointY="5.75" /> + <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="12.5" PointY="11.625" /> + <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="8" PointY="31.75" /> + <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="0.75" PointY="2.5" /> + <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="2.75" PointY="2.5" /> + <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="0.75" PointY="5.5" /> + <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="2.75" PointY="5.5" /> + <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="4.75" PointY="2.5" /> + <EntityTypeShape EntityType="RemoteModel.TECH_MOTORS" Width="1.5" PointX="6.75" PointY="2.5" /> + <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="2.75" PointY="9.5" /> + <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="8" PointY="26.875" /> + <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="10.25" PointY="27.625" /> + <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="8" PointY="23.75" /> <AssociationConnector Association="RemoteModel.FK_EVENTS_ACTIONS_ACTIONS" /> <AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" /> <AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" /> @@ -83,6 +83,7 @@ <AssociationConnector Association="RemoteModel.FK_BRUSH_STOPS_SEGMENTS" /> <AssociationConnector Association="RemoteModel.FK_IDS_PACKS_CARTRIDGE_TYPES" /> <AssociationConnector Association="RemoteModel.FK_CATS_LIQUID_TYPES1" /> + <AssociationConnector Association="RemoteModel.FK_CATS_MACHINES" /> <AssociationConnector Association="RemoteModel.FK_CATS_RMLS" /> <AssociationConnector Association="RemoteModel.FK_CCTS_RMLS" /> <AssociationConnector Association="RemoteModel.FK_COLOR_CATALOGS_COLOR_SPACES" /> diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/HiveControl.xaml.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/HiveControl.xaml.cs index 391c901cd..81fc1250d 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/HiveControl.xaml.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/HiveControl.xaml.cs @@ -141,7 +141,7 @@ namespace Tango.SharedUI.Controls hexagon.VerticalAlignment = VerticalAlignment.Center; hexagon.Stroke = Brushes.Black; hexagon.StrokeThickness = 1; - hexagon.Fill = new SolidColorBrush(ColorHelper.GetRandomColor()); + hexagon.Fill = new SolidColorBrush(ColorHelper.GetRandomGrayscaleColor()); canvas.Children.Add(hexagon); Hexagons.Add(hexagon); diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/ColorComponentToOpacityConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/ColorComponentToOpacityConverter.cs new file mode 100644 index 000000000..e406f0c58 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/ColorComponentToOpacityConverter.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; + +namespace Tango.SharedUI.Converters +{ + public class ColorComponentToOpacityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + double v = System.Convert.ToDouble(value); + return v / 255d; + } + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/ColorToComponentsConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/ColorToComponentsConverter.cs new file mode 100644 index 000000000..b134c0cfb --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/ColorToComponentsConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; + +namespace Tango.SharedUI.Converters +{ + public class ColorToComponentsConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + double r = System.Convert.ToDouble(values[0]); + double g = System.Convert.ToDouble(values[1]); + double b = System.Convert.ToDouble(values[2]); + + return Color.FromRgb((byte)r, (byte)g, (byte)b); + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + Color color = (Color)value; + + return new object[] { (double)color.R, (double)color.G, (double)color.B }; + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index b639a25d8..856056cdc 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -92,6 +92,8 @@ <Compile Include="Converters\BooleanToVisibilityConverter.cs" /> <Compile Include="Converters\BooleanToVisibilityInverseConverter.cs" /> <Compile Include="Converters\BooleanToYesNoConverter.cs" /> + <Compile Include="Converters\ColorComponentToOpacityConverter.cs" /> + <Compile Include="Converters\ColorToComponentsConverter.cs" /> <Compile Include="Converters\ColorToIntegerConverter.cs" /> <Compile Include="Converters\DateTimeUTCToShortDateTimeConverter.cs" /> <Compile Include="Converters\DoubleToIntConverter.cs" /> |
