diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
71 files changed, 3567 insertions, 483 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/App.config b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/App.config index 825aaae9e..8f13814dc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/App.config +++ b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/App.config @@ -24,7 +24,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -32,27 +32,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -74,6 +74,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Views/DispensersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Views/DispensersView.xaml index a1d080380..a8262667e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Views/DispensersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Views/DispensersView.xaml @@ -8,6 +8,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.Dispensers.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:global="clr-namespace:Tango.MachineStudio.Dispensers" xmlns:local="clr-namespace:Tango.MachineStudio.Dispensers.Views" mc:Ignorable="d" @@ -54,7 +55,7 @@ </StackPanel> </Grid> <Grid IsEnabled="{Binding IsFree}"> - <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Dispensers}" SelectedItem="{Binding SelectedDispenser}"> + <controls:DoubleClickDataGrid Style="{StaticResource {x:Type DataGrid}}" DoubleClickCommand="{Binding ManageDispenserCommand}" Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Dispensers}" SelectedItem="{Binding SelectedDispenser}"> <DataGrid.CellStyle> <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> <Setter Property="BorderThickness" Value="0"/> @@ -73,7 +74,7 @@ <DataGridTextColumn Header="INSTALLED" Binding="{Binding IsInstalled}" Width="Auto" /> <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="1*" /> </DataGrid.Columns> - </DataGrid> + </controls:DoubleClickDataGrid> </Grid> </DockPanel> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.config new file mode 100644 index 000000000..bdee20423 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.config @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> + </dependentAssembly> + <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> + <dependentAssembly> + <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorCaptureModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorCaptureModule.cs new file mode 100644 index 000000000..8724f675c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorCaptureModule.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.MachineStudio.ColorCapture.Views; +using Tango.MachineStudio.Common; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.ColorCapture +{ + [StudioModule(15)] + public class ColorCaptureModule : StudioModuleBase + { + public override string Name + { + get + { + return "Color Capture"; + } + } + + public override string Description + { + get + { + return "Exposes Twine's color calibration technology through a real-time video capturing engine."; + } + } + + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/colorcapture_module.png"); + } + } + + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + public override Permissions Permission + { + get + { + return Permissions.RunColorCaptureModule; + } + } + + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorCaptureSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorCaptureSettings.cs new file mode 100644 index 000000000..63ed247ef --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorCaptureSettings.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.ColorCapture.Models; +using Tango.Settings; + +namespace Tango.MachineStudio.ColorCapture +{ + public class ColorCaptureSettings : SettingsBase + { + public CaptureConfig Config { get; set; } + + public ColorCaptureSettings() + { + Config = new CaptureConfig(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/ColorMatrixControl.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/ColorMatrixControl.cs new file mode 100644 index 000000000..7ea8681ab --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/ColorMatrixControl.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.ColorCapture.Controls +{ + public class ColorMatrixControl : Control + { + public ObservableCollection<Color> Colors + { + get { return (ObservableCollection<Color>)GetValue(ColorsProperty); } + set { SetValue(ColorsProperty, value); } + } + public static readonly DependencyProperty ColorsProperty = + DependencyProperty.Register("Colors", typeof(ObservableCollection<Color>), typeof(ColorMatrixControl), new PropertyMetadata(null)); + + public int Columns + { + get { return (int)GetValue(ColumnsProperty); } + set { SetValue(ColumnsProperty, value); } + } + public static readonly DependencyProperty ColumnsProperty = + DependencyProperty.Register("Columns", typeof(int), typeof(ColorMatrixControl), new PropertyMetadata(10)); + + public int Rows + { + get { return (int)GetValue(RowsProperty); } + set { SetValue(RowsProperty, value); } + } + public static readonly DependencyProperty RowsProperty = + DependencyProperty.Register("Rows", typeof(int), typeof(ColorMatrixControl), new PropertyMetadata(11)); + + public ColorMatrixControl() + { + Colors = new ObservableCollection<Color>(); + } + + static ColorMatrixControl() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorMatrixControl), new FrameworkPropertyMetadata(typeof(ColorMatrixControl))); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/IndexedUniformGrid.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/IndexedUniformGrid.cs new file mode 100644 index 000000000..93a5c07ab --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/IndexedUniformGrid.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace Tango.MachineStudio.ColorCapture.Controls +{ + public class IndexedUniformGrid : Grid + { + public int Columns + { + get { return (int)GetValue(ColumnsProperty); } + set { SetValue(ColumnsProperty, value); } + } + public static readonly DependencyProperty ColumnsProperty = + DependencyProperty.Register("Columns", typeof(int), typeof(IndexedUniformGrid), new PropertyMetadata(0, (d, e) => (d as IndexedUniformGrid).Init())); + + public int Rows + { + get { return (int)GetValue(RowsProperty); } + set { SetValue(RowsProperty, value); } + } + public static readonly DependencyProperty RowsProperty = + DependencyProperty.Register("Rows", typeof(int), typeof(IndexedUniformGrid), new PropertyMetadata(0, (d, e) => (d as IndexedUniformGrid).Init())); + + public IndexedUniformGrid() + { + Loaded += IndexedUniformGrid_Loaded; + } + + private void IndexedUniformGrid_Loaded(object sender, RoutedEventArgs e) + { + Init(); + } + + private void Init() + { + ColumnDefinitions.Clear(); + RowDefinitions.Clear(); + + for (int i = 0; i < Columns; i++) + { + ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); + } + + for (int i = 0; i < Rows; i++) + { + RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomLeft.bmp b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomLeft.bmp Binary files differnew file mode 100644 index 000000000..13b33704b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomLeft.bmp diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomRight.bmp b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomRight.bmp Binary files differnew file mode 100644 index 000000000..d2116fad2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomRight.bmp diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/colorcapture_module.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/colorcapture_module.png Binary files differnew file mode 100644 index 000000000..b6b8b53be --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/colorcapture_module.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topRight.bmp b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topRight.bmp Binary files differnew file mode 100644 index 000000000..f008d454d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topRight.bmp diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topleft.bmp b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topleft.bmp Binary files differnew file mode 100644 index 000000000..8115cf359 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topleft.bmp diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/video-frame.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/video-frame.png Binary files differnew file mode 100644 index 000000000..9c29dc438 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/video-frame.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/BenchmarkItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/BenchmarkItem.cs new file mode 100644 index 000000000..d7d33e437 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/BenchmarkItem.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using Tango.Core; +using Tango.PMR.TCC; + +namespace Tango.MachineStudio.ColorCapture.Models +{ + public class BenchmarkItem : ExtendedObject + { + private int _Red; + public int Red + { + get { return _Red; } + set { _Red = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Color)); } + } + + private int _Green; + public int Green + { + get { return _Green; } + set { _Green = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Color)); } + } + + private int _Blue; + public int Blue + { + get { return _Blue; } + set { _Blue = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Color)); } + } + + private double _L; + public double L + { + get { return _L; } + set { _L = value; RaisePropertyChangedAuto(); } + } + + private double _A; + public double A + { + get { return _A; } + set { _A = value; RaisePropertyChangedAuto(); } + } + + private double _B; + public double B + { + get { return _B; } + set { _B = value; RaisePropertyChangedAuto(); } + } + + public int Index { get; private set; } + + public Color Color + { + get { return Color.FromArgb(255, (byte)Red, (byte)Green, (byte)Blue); } + } + + public static BenchmarkItem FromDetectionBenchmark(DetectionBenchmark benchmark, int index) + { + BenchmarkItem item = new BenchmarkItem(); + + item.Red = benchmark.Red; + item.Green = benchmark.Green; + item.Blue = benchmark.Blue; + + item.L = benchmark.L; + item.A = benchmark.A; + item.B = benchmark.B; + + item.Index = index; + + return item; + } + + public DetectionBenchmark ToDetectionBenchmark() + { + DetectionBenchmark item = new DetectionBenchmark(); + + item.Red = Red; + item.Green = Green; + item.Blue = Blue; + + item.L = L; + item.A = A; + item.B = B; + + return item; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs new file mode 100644 index 000000000..0b74f2b3f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.Helpers; +using Tango.TCC.BL; + +namespace Tango.MachineStudio.ColorCapture.Models +{ + public class CaptureConfig : ExtendedObject + { + private int _columns; + public int Columns + { + get { return _columns; } + set { _columns = value; RaisePropertyChangedAuto(); } + } + + private int _rows; + public int Rows + { + get { return _rows; } + set { _rows = value; RaisePropertyChangedAuto(); } + } + + private int _targetIndex; + public int TargetIndex + { + get { return _targetIndex; } + set { _targetIndex = value; RaisePropertyChangedAuto(); } + } + + private String _samplesFolder; + public String SamplesFolder + { + get { return _samplesFolder; } + set { _samplesFolder = value; RaisePropertyChangedAuto(); } + } + + private String _benchmarksFile; + public String BenchmarksFile + { + get { return _benchmarksFile; } + set { _benchmarksFile = value; RaisePropertyChangedAuto(); } + } + + private String _templateFile; + public String TemplateFile + { + get { return _templateFile; } + set { _templateFile = value; RaisePropertyChangedAuto(); } + } + + private int _sampleWidth; + public int SampleWidth + { + get { return _sampleWidth; } + set { _sampleWidth = value; RaisePropertyChangedAuto(); } + } + + private int _sampleHeight; + public int SampleHeight + { + get { return _sampleHeight; } + set { _sampleHeight = value; RaisePropertyChangedAuto(); } + } + + private bool _autoRelease; + public bool AutoRelease + { + get { return _autoRelease; } + set { _autoRelease = value; RaisePropertyChangedAuto(); } + } + + private double _similarityTolerance; + public double SimilarityTolerance + { + get { return _similarityTolerance; } + set { _similarityTolerance = value; RaisePropertyChangedAuto(); } + } + + private DeltaEComparisons _deltaEComparison; + public DeltaEComparisons DeltaEComparison + { + get { return _deltaEComparison; } + set { _deltaEComparison = value; RaisePropertyChangedAuto(); } + } + + private CardDetectionHistogramMethods _histogramComparison; + public CardDetectionHistogramMethods HistogramComparison + { + get { return _histogramComparison; } + set { _histogramComparison = value; RaisePropertyChangedAuto(); } + } + + private bool _enableDoubleChecking; + public bool EnableDoubleChecking + { + get { return _enableDoubleChecking; } + set { _enableDoubleChecking = value; RaisePropertyChangedAuto(); } + } + + private bool _enforceBarcodeDetection; + public bool EnforceBarcodeDetection + { + get { return _enforceBarcodeDetection; } + set { _enforceBarcodeDetection = value; RaisePropertyChangedAuto(); } + } + + + public CaptureConfig() + { + Columns = 10; + Rows = 11; + TargetIndex = 89; + SampleWidth = 300; + SampleHeight = 330; + SimilarityTolerance = 50; + SamplesFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "TCC Samples"); + BenchmarksFile = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "TCC", "benchmarks_rgb_lab.csv"); + TemplateFile = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "TCC", "template.bmp"); + DeltaEComparison = DeltaEComparisons.CieDe2000; + HistogramComparison = CardDetectionHistogramMethods.Chi_Square; + EnableDoubleChecking = true; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureItem.cs new file mode 100644 index 000000000..66fe7d7af --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureItem.cs @@ -0,0 +1,31 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; + +namespace Tango.MachineStudio.ColorCapture.Models +{ + public class CaptureItem + { + public DateTime Time { get; set; } + + [JsonIgnore] + public String Folder { get; set; } + + [JsonIgnore] + public String Image { get; set; } + + public Color CapturedColor { get; set; } + public Color ProcessedColor { get; set; } + public Color RefColor { get; set; } + + public double RefL { get; set; } + public double RefA { get; set; } + public double RefB { get; set; } + + public double DeltaE { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs new file mode 100644 index 000000000..8f3ab87c8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.ColorCapture.Models +{ + public enum DeltaEComparisons + { + Cie1976, + Cie94, + CieDe2000, + Cmc + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..b86e2231d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Machine Studio Color Capture Module")] +[assembly: AssemblyVersion("2.0.12.1608")] + +[assembly: ComVisible(false)] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.Designer.cs new file mode 100644 index 000000000..80918eb2e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.ColorCapture.Properties { + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.ColorCapture.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.Designer.cs new file mode 100644 index 000000000..fccfa223f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.ColorCapture.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj new file mode 100644 index 000000000..9f21cadf2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{1B87CA53-50BD-4C48-A8C7-FBB9F1419AFF}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.MachineStudio.ColorCapture</RootNamespace> + <AssemblyName>Tango.MachineStudio.ColorCapture</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <Deterministic>true</Deterministic> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\Machine Studio\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\Machine Studio\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.2.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.2.0\lib\net45\EntityFramework.SqlServer.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="Microsoft.WindowsAPICodePack.Shell, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll</HintPath> + </Reference> + <Reference Include="Microsoft.WindowsAPICodePack.ShellExtensions, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <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" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Page Include="Themes\Generic.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="ColorCaptureSettings.cs" /> + <Compile Include="ColorCaptureModule.cs" /> + <Compile Include="Controls\ColorMatrixControl.cs" /> + <Compile Include="Controls\IndexedUniformGrid.cs" /> + <Compile Include="Models\BenchmarkItem.cs" /> + <Compile Include="Models\CaptureConfig.cs" /> + <Compile Include="Models\CaptureItem.cs" /> + <Compile Include="Models\DeltaEComparisons.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <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> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\ColorMine\ColorMine.csproj"> + <Project>{37e4ceab-b54b-451f-b535-04cf7da9c459}</Project> + <Name>ColorMine</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX-master\RealTimeGraphX.WPF\RealTimeGraphX.WPF.csproj"> + <Project>{6b9774f7-960d-438e-ad81-c6b9be328d50}</Project> + <Name>RealTimeGraphX.WPF</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX-master\RealTimeGraphX\RealTimeGraphX.csproj"> + <Project>{f13a489c-80ee-4cd0-bdd4-92d959215646}</Project> + <Name>RealTimeGraphX</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.CircularGauge\Tango.CircularGauge.csproj"> + <Project>{6efd5895-177b-4bbb-af52-29f4d53b3fbd}</Project> + <Name>Tango.CircularGauge</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.CSV\Tango.CSV.csproj"> + <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project> + <Name>Tango.CSV</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Video\Tango.Video.csproj"> + <Project>{9652f972-2bd1-4283-99cb-fc6240434c17}</Project> + <Name>Tango.Video</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\TCC\Tango.TCC.BL\Tango.TCC.BL.csproj"> + <Project>{f209fae8-73f9-441b-97f4-0844a0279390}</Project> + <Name>Tango.TCC.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\TCC\Tango.TCC.OpenCV.DLL\Tango.TCC.OpenCV.DLL.csproj"> + <Project>{5d0d4053-cab3-4a4a-929e-37a76483bc22}</Project> + <Name>Tango.TCC.OpenCV.DLL</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj"> + <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> + <Name>Tango.MachineStudio.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\video-frame.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\colorcapture_module.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\bottomLeft.bmp" /> + <Resource Include="Images\bottomRight.bmp" /> + <Resource Include="Images\topleft.bmp" /> + <Resource Include="Images\topRight.bmp" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Themes/Generic.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Themes/Generic.xaml new file mode 100644 index 000000000..87a3f1bf2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Themes/Generic.xaml @@ -0,0 +1,44 @@ +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:controls="clr-namespace:Tango.MachineStudio.ColorCapture.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.ColorCapture"> + + + <Style TargetType="{x:Type controls:ColorMatrixControl}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type controls:ColorMatrixControl}"> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + <Grid> + <ItemsControl ItemsSource="{TemplateBinding Colors}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="{Binding RelativeSource={RelativeSource AncestorType=controls:ColorMatrixControl},Path=Columns}" Rows="{Binding RelativeSource={RelativeSource AncestorType=controls:ColorMatrixControl},Path=Rows}" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Rectangle> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <controls:IndexedUniformGrid Columns="{TemplateBinding Columns}" Rows="{TemplateBinding Rows}"> + <Image Source="/Tango.MachineStudio.ColorCapture;component/Images/topLeft.bmp" Stretch="Fill" Grid.Column="0" Grid.Row="0" /> + <Image Source="/Tango.MachineStudio.ColorCapture;component/Images/topRight.bmp" Stretch="Fill" Grid.Column="{TemplateBinding Columns}" Grid.Row="0" /> + <Image Source="/Tango.MachineStudio.ColorCapture;component/Images/bottomLeft.bmp" Stretch="Fill" Grid.Column="0" Grid.Row="{TemplateBinding Rows}" /> + <Image Source="/Tango.MachineStudio.ColorCapture;component/Images/bottomRight.bmp" Stretch="Fill" Grid.Column="{TemplateBinding Columns}" Grid.Row="{TemplateBinding Rows}" /> + </controls:IndexedUniformGrid> + </Grid> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> +</ResourceDictionary> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModelLocator.cs new file mode 100644 index 000000000..75cb5fad6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModelLocator.cs @@ -0,0 +1,29 @@ +using Tango.Core.DI; +using Tango.MachineStudio.ColorCapture.ViewModels; +using Tango.MachineStudio.ColorCapture.Views; + +namespace Tango.MachineStudio.ColorCapture +{ + /// <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() + { + TangoIOC.Default.Register<MainViewVM>(); + } + + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance<MainViewVM>(); + } + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..31eec0871 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs @@ -0,0 +1,543 @@ +using ColorMine.ColorSpaces; +using ColorMine.ColorSpaces.Comparisons; +using Microsoft.Win32; +using Microsoft.WindowsAPICodePack.Dialogs; +using RealTimeGraphX.DataPoints; +using RealTimeGraphX.WPF; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using Tango.Core; +using Tango.Core.Commands; +using Tango.CSV; +using Tango.Logging; +using Tango.MachineStudio.ColorCapture.Models; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.Video; +using Tango.PMR.TCC; +using Tango.Settings; +using Tango.TCC.BL; +using Tango.Video.DirectCapture; + +namespace Tango.MachineStudio.ColorCapture.ViewModels +{ + public class MainViewVM : StudioViewModel + { + private INotificationProvider _notification; + private CardDetector _cardDetector; + private int _sampleCounter; + private bool _abort; + private BitmapSource _last_original_source; + private DetectionOutput _last_detection_output; + private byte[] templateBitmap; + private DeltaEComparisons _lastDeltaEComparison; + private IColorSpaceComparison _deltaEComparison; + + public IVideoCaptureProvider VideoProvider { get; set; } + + private CaptureDevice _selectedVideoDevice; + public CaptureDevice SelectedVideoDevice + { + get { return _selectedVideoDevice; } + set + { + var oldValue = _selectedVideoDevice; + _selectedVideoDevice = value; + RaisePropertyChangedAuto(); + OnSelectedVideoDeviceChanged(oldValue, _selectedVideoDevice); + } + } + + private BitmapSource _detectedSource; + public BitmapSource DetectedSource + { + get { return _detectedSource; } + set { _detectedSource = value; RaisePropertyChangedAuto(); InvokeUI(() => CreateSnapshotCommand.RaiseCanExecuteChanged()); } + } + + private ObservableCollection<Color> _colors; + public ObservableCollection<Color> Colors + { + get { return _colors; } + set { _colors = value; RaisePropertyChangedAuto(); RaisePropertyChangedAuto(); } + } + + private Color _processedColor; + public Color ProcessedColor + { + get { return _processedColor; } + set { _processedColor = value; RaisePropertyChangedAuto(); } + } + + private Color _capturedColor; + public Color CapturedColor + { + get { return _capturedColor; } + set { _capturedColor = value; RaisePropertyChangedAuto(); } + } + + private double _measureL; + public double MeasureL + { + get { return _measureL; } + set { _measureL = value; RaisePropertyChangedAuto(); } + } + + private double _measureA; + public double MeasureA + { + get { return _measureA; } + set { _measureA = value; RaisePropertyChangedAuto(); } + } + + private double _measureB; + public double MeasureB + { + get { return _measureB; } + set { _measureB = value; RaisePropertyChangedAuto(); } + } + + public double DeltaE { get; set; } + + public WpfGraphController<DoubleDataPoint, DoubleDataPoint> CaptureDeltaEController { get; set; } + + public RelayCommand ToggleCameraCommand { get; set; } + + public SynchronizedObservableCollection<CaptureItem> CaptureItems { get; set; } + + private ObservableCollection<BenchmarkItem> _benchmarks; + public ObservableCollection<BenchmarkItem> Benchmarks + { + get { return _benchmarks; } + set { _benchmarks = value; RaisePropertyChangedAuto(); } + } + + private CaptureConfig _config; + public CaptureConfig Config + { + get { return _config; } + set { _config = value; RaisePropertyChangedAuto(); } + } + + private bool _isPaused; + public bool IsPaused + { + get { return _isPaused; } + set { _isPaused = value; RaisePropertyChangedAuto(); } + } + + private double _similarity; + public double Similarity + { + get { return _similarity; } + set { _similarity = value; RaisePropertyChangedAuto(); } + } + + private String _barcode; + public String Barcode + { + get { return _barcode; } + set { _barcode = value; RaisePropertyChangedAuto(); } + } + + + public RelayCommand ImportBenchmarksCommand { get; set; } + + public RelayCommand ExportBenchmarksCommand { get; set; } + + public RelayCommand CreateSnapshotCommand { get; set; } + + public RelayCommand<CaptureItem> OpenCaptureItemCommand { get; set; } + + public RelayCommand SelectSamplesFolderCommand { get; set; } + + public RelayCommand SelectBenchmarksFileCommand { get; set; } + + public RelayCommand SelectTemplateFileCommand { get; set; } + + public MainViewVM() + { + Config = new CaptureConfig(); + CaptureItems = new SynchronizedObservableCollection<CaptureItem>(); + Benchmarks = new ObservableCollection<BenchmarkItem>(); + _cardDetector = new CardDetector(); + ToggleCameraCommand = new RelayCommand(ToggleCamera); + CaptureDeltaEController = new WpfGraphController<DoubleDataPoint, DoubleDataPoint>(); + CaptureDeltaEController.DataSeriesCollection.Add(new WpfGraphDataSeries() + { + Stroke = System.Windows.Media.Colors.DodgerBlue, + }); + CaptureDeltaEController.Range.AutoY = true; + CaptureDeltaEController.Range.MaximumX = 1000; + + ImportBenchmarksCommand = new RelayCommand(OpenBenchmarksFile); + ExportBenchmarksCommand = new RelayCommand(SaveBenchmarksFile); + CreateSnapshotCommand = new RelayCommand(CreateSnapshot, () => DetectedSource != null); + OpenCaptureItemCommand = new RelayCommand<CaptureItem>(OpenCaptureItem); + SelectSamplesFolderCommand = new RelayCommand(SelectSamplesFolder); + SelectBenchmarksFileCommand = new RelayCommand(SelectBenchmarkFile); + SelectTemplateFileCommand = new RelayCommand(SelectTemplateFile); + } + + public MainViewVM(IVideoCaptureProvider videoProvider, INotificationProvider notificationProvider) : this() + { + _notification = notificationProvider; + VideoProvider = videoProvider; + SelectedVideoDevice = videoProvider.AvailableCaptureDevices.FirstOrDefault(); + } + + private void SelectTemplateFile() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "Bitmap Files|*.bmp"; + if (dlg.ShowDialog().Value) + { + templateBitmap = File.ReadAllBytes(Config.TemplateFile); + Config.TemplateFile = dlg.FileName; + } + } + + private void SelectBenchmarkFile() + { + OpenBenchmarksFile(); + } + + private void SelectSamplesFolder() + { + CommonOpenFileDialog dlg = new CommonOpenFileDialog(); + dlg.Title = "Select samples folder."; + dlg.IsFolderPicker = true; + if (dlg.ShowDialog() == CommonFileDialogResult.Ok) + { + Config.SamplesFolder = dlg.FileName; + } + } + + private void OpenCaptureItem(CaptureItem item) + { + using (_notification.PushTaskItem("Opening snapshot folder...")) + { + Process.Start("explorer.exe", string.Format("/select,\"{0}\"", item.Image)); + } + } + + private void CreateSnapshot() + { + try + { + DateTime now = DateTime.Now; + + Directory.CreateDirectory(Config.SamplesFolder); + + String sample_folder = Config.SamplesFolder + "\\" + now.ToFileName(); + Directory.CreateDirectory(sample_folder); + + String rectified_file = sample_folder + "\\rectified.bmp"; + DetectedSource.SaveBmpFile(rectified_file); + + String original_file = sample_folder + "\\source.bmp"; + _last_original_source.SaveBmpFile(original_file); + + String means_file = sample_folder + "\\means.bmp"; + var bitmap = ColorDetector.DetectionOutputToImage(new DetectionInput() + { + Columns = Config.Columns, + Rows = Config.Rows, + TargetIndex = Config.TargetIndex + + }, _last_detection_output, Config.SampleWidth, Config.SampleHeight); + + bitmap.Save(means_file); + + String capture_item_file = sample_folder + "\\info.txt"; + + var rgb = new Lab(MeasureL, _measureA, _measureB).ToRgb(); + Color refColor = Color.FromArgb(255, (byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + + CsvFile<DetectionColor> means_csv = new CsvFile<DetectionColor>(new CsvDestination(sample_folder + "\\means.csv")); + + foreach (var item in ColorDetector.EmptyColorMatrixFiducials(new DetectionInput() + { + Columns = Config.Columns, + Rows = Config.Rows, + }, _last_detection_output)) + { + means_csv.Append(item); + } + + means_csv.Dispose(); + + var captureItem = new CaptureItem() + { + Image = rectified_file, + CapturedColor = CapturedColor, + ProcessedColor = ProcessedColor, + RefColor = refColor, + DeltaE = DeltaE, + RefL = MeasureL, + RefA = MeasureA, + RefB = MeasureB, + Time = now, + Folder = sample_folder, + }; + + File.WriteAllText(capture_item_file, captureItem.ToJsonString()); + + CaptureItems.Insert(0, captureItem); + + Clear(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error in color capture snapshot save method."); + _notification.ShowError($"An error occurred while trying to create the snapshot. Please try again.\n{ex.Message}"); + } + } + + private void SaveBenchmarksFile() + { + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "CSV Files|*.csv"; + if (dlg.ShowDialog().Value) + { + try + { + ExportBenchmarks(dlg.FileName); + _notification.ShowInfo("Benchmarks successfully saved."); + } + catch (Exception ex) + { + _notification.ShowError($"An error occurred while trying to export the benchmark file.\n{ex.FlattenMessage()}"); + } + } + } + + private void OpenBenchmarksFile() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "CSV Files|*.csv"; + if (dlg.ShowDialog().Value) + { + try + { + ImportBenchmarks(dlg.FileName); + _notification.ShowInfo("Benchmarks successfully loaded."); + } + catch (Exception ex) + { + _notification.ShowError($"An error occurred while trying to import the benchmark file.\n{ex.FlattenMessage()}"); + } + } + } + + private void ExportBenchmarks(String file) + { + ColorDetector.SaveBenchmarks(file, Benchmarks.ToList().Select(x => x.ToDetectionBenchmark())); + } + + private void ImportBenchmarks(String file) + { + var marks = ColorDetector.LoadBenchmarks(file).ToList(); + var benchmarks = marks.Select(x => BenchmarkItem.FromDetectionBenchmark(x, marks.IndexOf(x))).ToList(); + Benchmarks = new ObservableCollection<BenchmarkItem>(benchmarks); + Config.BenchmarksFile = file; + } + + private void ToggleCamera() + { + if (SelectedVideoDevice != null) + { + if (SelectedVideoDevice.IsStarted) + { + if (!IsPaused) + { + _abort = true; + SelectedVideoDevice.Stop(); + Clear(); + } + else + { + IsPaused = false; + Clear(); + } + } + else + { + _abort = false; + SelectedVideoDevice.Resolution = new Resolution(1280, 720); + SelectedVideoDevice.Start(); + } + } + } + + private void Clear() + { + ProcessedColor = System.Windows.Media.Colors.Transparent; + CapturedColor = System.Windows.Media.Colors.Transparent; + Colors = null; + DetectedSource = null; + CaptureDeltaEController.Clear(); + Similarity = 0; + Barcode = String.Empty; + } + + private void OnSelectedVideoDeviceChanged(CaptureDevice previousDevice, CaptureDevice newDevice) + { + if (previousDevice != null) + { + previousDevice.FrameReceived -= OnVideoFrameReceived; + } + + if (newDevice != null) + { + newDevice.RaiseFrameReceivedEvent = true; + newDevice.FrameReceived += OnVideoFrameReceived; + } + } + + private async void OnVideoFrameReceived(object sender, Video.DirectShow.EventArguments.FrameReceivedEventArgs args) + { + if (_abort || IsPaused) return; + + if (_cardDetector.CanDetect) + { + var result = await _cardDetector.Detect(args.BitmapSource, new CardDetectionConfig() + { + Benchmarks = Benchmarks.ToList().Select(x => x.ToDetectionBenchmark()).ToList(), + Columns = Config.Columns, + Rows = Config.Rows, + DesiredBitmapWidth = Config.SampleWidth, + DesiredBitmapHeight = Config.SampleHeight, + TargetIndex = Config.TargetIndex, + TemplateBitmapBytes = templateBitmap, + SimilarityTolerance = Config.SimilarityTolerance, + HistogramMethod = Config.HistogramComparison, + EnableDoubleChecking = Config.EnableDoubleChecking, + EnforceBarcodeDetection = Config.EnforceBarcodeDetection, + }); + + if (result.Similarity > 0) + { + Similarity = result.Similarity; + } + + if (result.IsDetected) + { + if (Config.AutoRelease) + { + IsPaused = true; + } + + _last_original_source = result.Source; + _last_detection_output = result.ColorDetectionOutput; + + DetectedSource = result.DetectedBitmap; + + if (Colors == null) + { + Colors = new ObservableCollection<Color>(Enumerable.Range(0, result.ColorDetectionOutput.ColorMatrix.Count).Select(x => new Color())); + } + + InvokeUI(() => + { + for (int i = 0; i < result.ColorDetectionOutput.ColorMatrix.Count; i++) + { + var detectedColor = result.ColorDetectionOutput.ColorMatrix[i]; + Colors[i] = Color.FromArgb(255, (byte)detectedColor.R, (byte)detectedColor.G, (byte)detectedColor.B); + } + + CapturedColor = Color.FromArgb(255, (byte)result.ColorDetectionOutput.RawColor.R, (byte)result.ColorDetectionOutput.RawColor.G, (byte)result.ColorDetectionOutput.RawColor.B); + ProcessedColor = Color.FromArgb(255, (byte)result.ColorDetectionOutput.ProcessedColor.R, (byte)result.ColorDetectionOutput.ProcessedColor.G, (byte)result.ColorDetectionOutput.ProcessedColor.B); + + Barcode = result.Barcode; + + //calculate delta E. + Lab measureLab = new Lab(MeasureL, MeasureA, MeasureB); + DeltaE = measureLab.Compare(new Rgb(ProcessedColor.R, ProcessedColor.G, ProcessedColor.B), GetDeltaEComparison()); + }); + } + } + + if (double.IsInfinity(DeltaE)) + { + DeltaE = 0; + } + + CaptureDeltaEController.PushData(_sampleCounter++, DeltaE); + } + + public override void OnApplicationReady() + { + Config = SettingsManager.Default.GetOrCreate<ColorCaptureSettings>().Config; + + //Load benchmarks. + if (File.Exists(Config.BenchmarksFile)) + { + try + { + ImportBenchmarks(Config.BenchmarksFile); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading benchmarks."); + } + } + else + { + LogManager.Log("Could not locate benchmarks csv file.", LogCategory.Warning); + } + + //Load template bitmap. + if (File.Exists(Config.TemplateFile)) + { + templateBitmap = File.ReadAllBytes(Config.TemplateFile); + } + else + { + LogManager.Log("Could not locate template bitmap file.", LogCategory.Warning); + } + } + + public override void OnShuttingDown() + { + base.OnShuttingDown(); + SettingsManager.Default.GetOrCreate<ColorCaptureSettings>().Config = Config; + SettingsManager.Default.Save(); + } + + private IColorSpaceComparison GetDeltaEComparison() + { + if (_lastDeltaEComparison != Config.DeltaEComparison || _deltaEComparison == null) + { + _lastDeltaEComparison = Config.DeltaEComparison; + + if (Config.DeltaEComparison == DeltaEComparisons.Cie1976) + { + _deltaEComparison = new Cie1976Comparison(); + } + else if (Config.DeltaEComparison == DeltaEComparisons.Cie94) + { + _deltaEComparison = new Cie94Comparison(); + } + else if (Config.DeltaEComparison == DeltaEComparisons.CieDe2000) + { + _deltaEComparison = new CieDe2000Comparison(); + } + else if (Config.DeltaEComparison == DeltaEComparisons.Cmc) + { + _deltaEComparison = new CmcComparison(); + } + } + + return _deltaEComparison; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml new file mode 100644 index 000000000..afdac7e18 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml @@ -0,0 +1,653 @@ +<UserControl x:Class="Tango.MachineStudio.ColorCapture.Views.MainView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + 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:models="clr-namespace:Tango.MachineStudio.ColorCapture.Models" + xmlns:gauge="clr-namespace:Tango.CircularGauge;assembly=Tango.CircularGauge" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.ColorCapture.ViewModels" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" + xmlns:controls="clr-namespace:Tango.MachineStudio.ColorCapture.Controls" + xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:tcc="clr-namespace:Tango.TCC.BL;assembly=Tango.TCC.BL" + xmlns:realtimeGraphX="clr-namespace:RealTimeGraphX.WPF;assembly=RealTimeGraphX.WPF" + xmlns:global="clr-namespace:Tango.MachineStudio.ColorCapture" + xmlns:local="clr-namespace:Tango.MachineStudio.ColorCapture.Views" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" Background="#202020" Foreground="#BBBBBB" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml"> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + + <SolidColorBrush x:Key="Foreground" Color="#BBBBBB" /> + <SolidColorBrush x:Key="Background" Color="#202020" /> + <SolidColorBrush x:Key="Accent" Color="#03A9F4" /> + <SolidColorBrush x:Key="Red" Color="#FF5F5F" /> + <SolidColorBrush x:Key="Green" Color="#68E46E" /> + <SolidColorBrush x:Key="Blue" Color="#64B8EC" /> + <SolidColorBrush x:Key="BorderBrush" Color="#3E3E3E" /> + <SolidColorBrush x:Key="LightBackground" Color="#303030" /> + + <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> + </ResourceDictionary> + </UserControl.Resources> + + <Grid Margin="20"> + <TabControl Background="{StaticResource Background}" Foreground="{StaticResource Foreground}"> + <TabControl.Resources> + <Style TargetType="TabPanel"> + <Setter Property="HorizontalAlignment" Value="Center"/> + </Style> + <Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="Padding" Value="20,2"></Setter> + </Style> + </TabControl.Resources> + <TabItem Header="CAPTURE" Foreground="{StaticResource Foreground}"> + <TabItem.HeaderTemplate> + <DataTemplate> + <TextBlock Text="{Binding}" FontSize="25" VerticalAlignment="Center"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TabItem},Path=IsSelected}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource Accent}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </TabItem.HeaderTemplate> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="600"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="800"/> + <ColumnDefinition Width="200"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Border RenderOptions.BitmapScalingMode="Fant"> + <Grid> + <DockPanel> + <DockPanel DockPanel.Dock="Top" TextElement.FontSize="16"> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold">Capture Device</TextBlock> + <Button DockPanel.Dock="Right" Command="{Binding ToggleCameraCommand}" CommandParameter="{Binding}" Style="{StaticResource MaterialDesignFlatButton}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="50" Height="50" Padding="0"> + <materialDesign:PackIcon Width="40" Height="40"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Kind" Value="Play"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="True"> + <Setter Property="Kind" Value="Stop"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="False"> + <Setter Property="Kind" Value="Play"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsPaused}" Value="True"> + <Setter Property="Kind" Value="Play"></Setter> + <DataTrigger.EnterActions> + <BeginStoryboard x:Name="blink"> + <Storyboard> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01" RepeatBehavior="Forever"> + <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" /> + <DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="1" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <RemoveStoryboard BeginStoryboardName="blink" /> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </Button> + <ComboBox FontWeight="SemiBold" Margin="20 0" ItemsSource="{Binding VideoProvider.AvailableCaptureDevices}" SelectedItem="{Binding SelectedVideoDevice}" DisplayMemberPath="Device" BorderBrush="{StaticResource Foreground}"></ComboBox> + </DockPanel> + + <Border Padding="2" Background="{StaticResource LightBackground}" BorderThickness="1" BorderBrush="{StaticResource Accent}" Margin="0 10 0 0"> + <Grid> + <Image Source="{Binding SelectedVideoDevice.VideoSource,Mode=OneWay,IsAsync=True}" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="False"> + <Setter Property="Visibility" Value="Hidden"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + + <Border HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="40 10" CornerRadius="20" Margin="20" Visibility="{Binding SelectedVideoDevice.IsStarted,Converter={StaticResource BoolToVisConverter}}"> + <Border.Background> + <SolidColorBrush Color="Black" Opacity="0.5"></SolidColorBrush> + </Border.Background> + + <TextBlock Foreground="{StaticResource Accent}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Text" Value="Scanning..."></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsPaused}" Value="True"> + <Setter Property="Text" Value="Card captured. Press 'play 'to resume scanning."></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </Border> + </Grid> + </Border> + </DockPanel> + </Grid> + </Border> + + <Grid Grid.Column="1"> + <DockPanel Margin="20 130 20 20" VerticalAlignment="Top"> + <TextBlock DockPanel.Dock="Top" FontSize="14" HorizontalAlignment="Center" FontWeight="SemiBold" Foreground="{StaticResource Accent}">Similarity</TextBlock> + <Viewbox Margin="0 10 0 0"> + <gauge:CircularGaugeControl + Radius="150" + ScaleRadius="110" + ScaleStartAngle="120" + ScaleSweepAngle="300" + PointerLength="85" + PointerCapRadius="35" + MinValue="0" + MaxValue="100" + MajorDivisionsCount="10" + MinorDivisionsCount="5" + CurrentValue="{Binding Similarity}" + ImageSize="40,50" + RangeIndicatorThickness="8" + RangeIndicatorRadius="120" + RangeIndicatorLightRadius="10" + RangeIndicatorLightOffset="80" + ScaleLabelRadius="90" + ScaleLabelSize="40,20" + ScaleLabelFontSize="18" + DialTextFontSize="18" + ScaleLabelForeground="LightGray" + MajorTickSize="10,3" + MinorTickSize="3,1" + MajorTickColor="LightGray" + MinorTickColor="LightGray" + ImageOffset="-50" + GaugeBackgroundColor="Black" + PointerThickness ="16" + OptimalRangeStartValue="{Binding Config.SimilarityTolerance}" + OptimalRangeEndValue="100" + OptimalRangeColor="#04CB04" + AboveOptimalRangeColor="#FF5151" + DialTextOffset="40" + DialTextColor="Black" + > + + </gauge:CircularGaugeControl> + </Viewbox> + </DockPanel> + </Grid> + + <Grid Grid.Column="2" Margin="0 60 0 0" HorizontalAlignment="Left"> + <Grid.RowDefinitions> + <RowDefinition Height="180*"/> + <RowDefinition Height="130*"/> + </Grid.RowDefinitions> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="500"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <TextBlock Margin="0 -20 0 0" FontWeight="SemiBold" Foreground="{StaticResource Accent}">Rectified Image</TextBlock> + <Border Padding="2" Background="{StaticResource LightBackground}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="300" Height="310" BorderThickness="1" BorderBrush="{StaticResource Accent}"> + <Image Source="{Binding DetectedSource,Mode=OneWay,IsAsync=True}" Stretch="Fill"></Image> + </Border> + + <TextBlock Grid.Column="1" Margin="0 -20 0 0" FontWeight="SemiBold" Foreground="{StaticResource Accent}">Calculated Averages</TextBlock> + <Border Padding="2" HorizontalAlignment="Left" Grid.Column="1" VerticalAlignment="Top" Width="300" Height="310" BorderThickness="1" BorderBrush="{StaticResource Accent}"> + <controls:ColorMatrixControl Colors="{Binding Colors,Mode=OneWay}" Columns="10" Rows="11" Background="{StaticResource LightBackground}" /> + </Border> + </Grid> + + <Grid Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="500"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid Height="120" VerticalAlignment="Top" HorizontalAlignment="Left"> + <DockPanel> + <TextBlock Margin="0 10 0 0" DockPanel.Dock="Top" Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" FontSize="16">Captured Color</TextBlock> + <DockPanel Margin="0 5 0 0" TextElement.FontSize="16"> + <UniformGrid DockPanel.Dock="Right" Rows="3" Margin="10 0 0 0" Width="55"> + <TextBlock Foreground="{StaticResource Red}"><Run Text="R:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding CapturedColor.R,Mode=OneWay}"></Run></TextBlock> + <TextBlock Foreground="{StaticResource Green}"><Run Text="G:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding CapturedColor.G,Mode=OneWay}"></Run></TextBlock> + <TextBlock Foreground="{StaticResource Blue}"><Run Text="B:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding CapturedColor.B,Mode=OneWay}"></Run></TextBlock> + </UniformGrid> + <Border Padding="2" Width="300" BorderThickness="1" BorderBrush="{StaticResource Accent}" Background="{StaticResource LightBackground}"> + <Rectangle> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding CapturedColor,Mode=OneWay}" /> + </Rectangle.Fill> + </Rectangle> + </Border> + </DockPanel> + </DockPanel> + </Grid> + + <Grid Height="120" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1"> + <DockPanel> + <TextBlock Margin="0 10 0 0" DockPanel.Dock="Top" Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" FontSize="16">Processed Color</TextBlock> + <DockPanel Margin="0 5 0 0" TextElement.FontSize="16"> + <UniformGrid DockPanel.Dock="Right" Rows="3" Margin="10 0 0 0" Width="55"> + <TextBlock Foreground="{StaticResource Red}"><Run Text="R:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding ProcessedColor.R,Mode=OneWay}"></Run></TextBlock> + <TextBlock Foreground="{StaticResource Green}"><Run Text="G:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding ProcessedColor.G,Mode=OneWay}"></Run></TextBlock> + <TextBlock Foreground="{StaticResource Blue}"><Run Text="B:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding ProcessedColor.B,Mode=OneWay}"></Run></TextBlock> + </UniformGrid> + <Border Padding="2" Width="300" BorderThickness="1" BorderBrush="{StaticResource Accent}" Background="{StaticResource LightBackground}"> + <Rectangle> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding ProcessedColor,Mode=OneWay}" /> + </Rectangle.Fill> + </Rectangle> + </Border> + </DockPanel> + </DockPanel> + + <TextBlock Margin="0 0 0 -20" VerticalAlignment="Bottom"> + <Run>Barcode:</Run> + <Run Text="{Binding Barcode}" FontWeight="SemiBold" FontStyle="Italic"></Run> + </TextBlock> + </Grid> + + <DockPanel VerticalAlignment="Bottom" Grid.ColumnSpan="2" TextElement.FontSize="16"> + <TextBlock HorizontalAlignment="Center" Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" FontSize="16">Delta E Reference Point</TextBlock> + <UniformGrid Columns="3" Margin="20 0 70 0"> + <DockPanel> + <TextBlock FontWeight="SemiBold">L:</TextBlock> + <mahapps:NumericUpDown BorderBrush="{StaticResource BorderBrush}" MinWidth="120" HorizontalContentAlignment="Left" Value="{Binding MeasureL,UpdateSourceTrigger=PropertyChanged}" Minimum="0" Maximum="100" Margin="5 0 0 0" HasDecimals="True" HideUpDownButtons="True" Background="{StaticResource LightBackground}" FontSize="16" Foreground="{StaticResource Accent}" BorderThickness="1" /> + </DockPanel> + + <DockPanel> + <TextBlock Margin="20 0 0 0" FontWeight="SemiBold">A:</TextBlock> + <mahapps:NumericUpDown BorderBrush="{StaticResource BorderBrush}" MinWidth="120" HorizontalContentAlignment="Left" Value="{Binding MeasureA,UpdateSourceTrigger=PropertyChanged}" Minimum="-127" Maximum="128" Margin="5 0 0 0" HasDecimals="True" HideUpDownButtons="True" Background="{StaticResource LightBackground}" FontSize="16" Foreground="{StaticResource Accent}" BorderThickness="1" /> + </DockPanel> + + <DockPanel> + <TextBlock Margin="20 0 0 0" FontWeight="SemiBold">B:</TextBlock> + <mahapps:NumericUpDown BorderBrush="{StaticResource BorderBrush}" MinWidth="120" HorizontalContentAlignment="Left" Value="{Binding MeasureB,UpdateSourceTrigger=PropertyChanged}" Minimum="-127" Maximum="128" Margin="5 0 0 0" HasDecimals="True" HideUpDownButtons="True" Background="{StaticResource LightBackground}" FontSize="16" Foreground="{StaticResource Accent}" BorderThickness="1" /> + </DockPanel> + </UniformGrid> + </DockPanel> + </Grid> + </Grid> + </Grid> + + <Grid Grid.Row="1" Margin="0 40 0 0"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="800"/> + <ColumnDefinition Width="200"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + <DockPanel> + <DockPanel DockPanel.Dock="Top" LastChildFill="False"> + <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" FontSize="16">Snapshots</TextBlock> + <Button Command="{Binding CreateSnapshotCommand}" Height="35" DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ChevronDoubleDown" VerticalAlignment="Center" /> + <TextBlock Margin="10 0 0 0">Create Snapshot</TextBlock> + </StackPanel> + </Button> + </DockPanel> + <sharedControls:DoubleClickDataGrid DoubleClickCommand="{Binding OpenCaptureItemCommand}" Style="{StaticResource {x:Type DataGrid}}" ItemsSource="{Binding CaptureItems}" GridLinesVisibility="None" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False" IsReadOnly="True" Margin="0 10 0 0" Background="{StaticResource LightBackground}" Grid.ColumnSpan="2" TextElement.Foreground="Gainsboro" BorderBrush="{StaticResource Accent}" BorderThickness="1"> + <DataGrid.RowStyle> + <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"> + <Setter Property="Foreground" Value="{StaticResource Foreground}"></Setter> + <Setter Property="BorderBrush" Value="#202020"></Setter> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Setter Property="BorderThickness" Value="0 0 0 1"></Setter> + <Style.Triggers> + <Trigger Property="IsMouseOver" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + <Setter Property="Cursor" Value="Hand"></Setter> + </Trigger> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + <Trigger Property="IsFocused" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.RowStyle> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="Foreground" Value="{StaticResource Foreground}"></Setter> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.CellStyle> + <DataGrid.ColumnHeaderStyle> + <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"> + <Setter Property="Foreground" Value="{StaticResource Foreground}"></Setter> + </Style> + </DataGrid.ColumnHeaderStyle> + <DataGrid.Columns> + <DataGridTemplateColumn Header="#" Width="50"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Image Width="30" Height="30" Source="{Binding Image}" Stretch="Fill"></Image> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="TIME" Binding="{Binding Time,StringFormat='HH:mm:ss.fff'}" /> + <DataGridTemplateColumn Header="REF" Width="80"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Rectangle Width="60"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding RefColor}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="CAPTURED" Width="90"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Rectangle Width="60"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding CapturedColor}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="PROCESSED" Width="90"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Rectangle Width="60"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding ProcessedColor}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + + <DataGridTextColumn Header="REF L" Width="70" Binding="{Binding RefL}" /> + <DataGridTextColumn Header="REF A" Width="70" Binding="{Binding RefA}" /> + <DataGridTextColumn Header="REF B" Width="70" Binding="{Binding RefB}" /> + <DataGridTextColumn Header="DELTA E" Binding="{Binding DeltaE}" /> + </DataGrid.Columns> + </sharedControls:DoubleClickDataGrid> + </DockPanel> + + <DockPanel Grid.Column="2" Margin="0 0 60 0"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" DockPanel.Dock="Top"> + <TextBlock Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" FontSize="16">Delta E Distance</TextBlock> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0"> + <Run>(</Run> + <Run Text="{Binding Config.DeltaEComparison}"></Run> + <Run>)</Run> + </TextBlock> + </StackPanel> + <Grid> + <Border Margin="0 10 0 0" Padding="0 0 15 0" BorderThickness="1" BorderBrush="#202020"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="55"/> + <ColumnDefinition Width="438*"/> + </Grid.ColumnDefinitions> + + <Border Margin="0 1 0 2"> + <realtimeGraphX:WpfGraphAxisControl Orientation="Vertical" Foreground="{StaticResource Accent}" FontSize="12" Controller="{Binding CaptureDeltaEController}" StringFormat="Δ 0.00;-#" /> + </Border> + <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource Accent}" Margin="1 0 0 0" Background="{StaticResource LightBackground}"> + <Grid> + + <realtimeGraphX:WpfGraphGridLines Foreground="#3E3E3E" /> + + <realtimeGraphX:WpfGraphSurface Controller="{Binding CaptureDeltaEController}"></realtimeGraphX:WpfGraphSurface> + </Grid> + </Border> + </Grid> + </Border> + </Grid> + </DockPanel> + </Grid> + </Grid> + </Grid> + </TabItem> + <TabItem Header="BENCHMARKS" Foreground="{StaticResource Foreground}"> + <TabItem.HeaderTemplate> + <DataTemplate> + <TextBlock Text="{Binding}" FontSize="25" VerticalAlignment="Center"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TabItem},Path=IsSelected}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource Accent}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </TabItem.HeaderTemplate> + + <Grid Margin="0 40 20 20"> + <DockPanel> + <StackPanel Margin="0 10 0 0" HorizontalAlignment="Right" Orientation="Horizontal" DockPanel.Dock="Bottom"> + <Button Command="{Binding ImportBenchmarksCommand}" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="45" MinWidth="150">IMPORT</Button> + <Button Command="{Binding ExportBenchmarksCommand}" Margin="10 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="45" MinWidth="150">EXPORT</Button> + </StackPanel> + + <Grid> + <DataGrid BorderBrush="{StaticResource Accent}" BorderThickness="1" AlternationCount="1000" SelectionMode="Single" SelectionUnit="FullRow" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False" IsReadOnly="True" GridLinesVisibility="None" ItemsSource="{Binding Benchmarks}" Background="{StaticResource LightBackground}"> + <DataGrid.RowStyle> + <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"> + <Setter Property="Foreground" Value="{StaticResource Foreground}"></Setter> + <Setter Property="BorderBrush" Value="#202020"></Setter> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Setter Property="BorderThickness" Value="0 0 0 1"></Setter> + <Style.Triggers> + <Trigger Property="IsMouseOver" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + <Setter Property="Cursor" Value="Hand"></Setter> + </Trigger> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + <Trigger Property="IsFocused" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.RowStyle> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="Foreground" Value="{StaticResource Foreground}"></Setter> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.CellStyle> + <DataGrid.ColumnHeaderStyle> + <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"> + <Setter Property="Foreground" Value="{StaticResource Foreground}"></Setter> + </Style> + </DataGrid.ColumnHeaderStyle> + <DataGrid.Columns> + + <DataGridTextColumn Width="100" Header="#" Binding="{Binding Index}"></DataGridTextColumn> + <DataGridTextColumn Header="RED" Binding="{Binding Red}"></DataGridTextColumn> + <DataGridTextColumn Header="GREEN" Binding="{Binding Green}"></DataGridTextColumn> + <DataGridTextColumn Header="BLUE" Binding="{Binding Blue}"></DataGridTextColumn> + + <DataGridTextColumn Header="L" Binding="{Binding L}"></DataGridTextColumn> + <DataGridTextColumn Header="A" Binding="{Binding A}"></DataGridTextColumn> + <DataGridTextColumn Header="B" Binding="{Binding B}"></DataGridTextColumn> + + <DataGridTemplateColumn Header="#" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Rectangle Width="200" HorizontalAlignment="Right"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </Grid> + </DockPanel> + </Grid> + </TabItem> + <TabItem Header="CONFIGURATION" Foreground="{StaticResource Foreground}"> + <TabItem.HeaderTemplate> + <DataTemplate> + <TextBlock Text="{Binding}" FontSize="25" VerticalAlignment="Center"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TabItem},Path=IsSelected}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource Accent}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </TabItem.HeaderTemplate> + + <Border Width="750" Margin="0 0 0 0" VerticalAlignment="Center" TextElement.FontSize="16" Background="{StaticResource LightBackground}" Padding="20" CornerRadius="10" BorderThickness="1" BorderBrush="{StaticResource Accent}"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="196*"/> + <ColumnDefinition Width="331*"/> + <ColumnDefinition Width="193*"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="200"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + </Grid.RowDefinitions> + + <TextBlock VerticalAlignment="Bottom" Height="27">Columns</TextBlock> + <TextBox Grid.Column="1" Text="{Binding Config.Columns}"></TextBox> + + <TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Rows</TextBlock> + <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Config.Rows}"></TextBox> + + <TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Target Index</TextBlock> + <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Config.TargetIndex}"></TextBox> + + <TextBlock Grid.Row="3" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Sample Width</TextBlock> + <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Config.SampleWidth}"></TextBox> + + <TextBlock Grid.Row="4" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Sample Height</TextBlock> + <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Config.SampleHeight}"></TextBox> + + <TextBlock Grid.Row="5" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Samples Folder</TextBlock> + <TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Config.SamplesFolder}" IsReadOnly="True" FontSize="10"></TextBox> + <Button Command="{Binding SelectSamplesFolderCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="5" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="31">SELECT</Button> + + <TextBlock Grid.Row="6" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Benchmarks</TextBlock> + <TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Config.BenchmarksFile}" IsReadOnly="True" FontSize="10"></TextBox> + <Button Command="{Binding SelectBenchmarksFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="6" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="31">SELECT</Button> + + <TextBlock Grid.Row="7" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Template</TextBlock> + + <DockPanel Grid.Row="7" Grid.Column="1"> + <TextBox Margin="0 10 0 0" DockPanel.Dock="Bottom" Text="{Binding Config.TemplateFile}" IsReadOnly="True" FontSize="10"></TextBox> + <DockPanel> + <TextBlock DockPanel.Dock="Right" FontSize="12" VerticalAlignment="Center" HorizontalAlignment="Right"> + <Run Text="{Binding ElementName=img,Path=Source.Width,Mode=OneWay,StringFormat='0'}"></Run> <Run>x</Run> <Run Text="{Binding ElementName=img,Path=Source.Height,Mode=OneWay,StringFormat='0'}"></Run> + </TextBlock> + <Border Width="150" Height="150" BorderThickness="1" BorderBrush="{StaticResource Accent}" Padding="1"> + <Image x:Name="img" Source="{Binding Config.TemplateFile}" Stretch="Fill"></Image> + </Border> + </DockPanel> + </DockPanel> + <Button Command="{Binding SelectTemplateFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="7" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="31">SELECT</Button> + + <TextBlock Grid.Row="8" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Similarity Tolerance</TextBlock> + <Slider Minimum="0" Maximum="100" Value="{Binding Config.SimilarityTolerance}" TickFrequency="1" IsSnapToTickEnabled="True" Grid.Row="8" Grid.Column="1" VerticalAlignment="Bottom" Height="18"></Slider> + <TextBlock Grid.Row="8" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Text="{Binding Config.SimilarityTolerance}"></TextBlock> + + <TextBlock Grid.Row="9" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Auto Release</TextBlock> + <ToggleButton IsChecked="{Binding Config.AutoRelease}" Grid.Row="9" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"></ToggleButton> + + <TextBlock Grid.Row="10" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Delta E Standard</TextBlock> + <ComboBox Grid.Row="10" Grid.Column="1" Margin="0 8 0 0" ItemsSource="{Binding Source={x:Type models:DeltaEComparisons},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Config.DeltaEComparison}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> + + <TextBlock Grid.Row="11" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Histogram Similarity</TextBlock> + <ComboBox Grid.Row="11" Grid.Column="1" Margin="0 8 0 0" ItemsSource="{Binding Source={x:Type tcc:CardDetectionHistogramMethods},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Config.HistogramComparison}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> + + <TextBlock Grid.Row="12" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Double Checking</TextBlock> + <ToggleButton IsChecked="{Binding Config.EnableDoubleChecking}" Grid.Row="12" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"></ToggleButton> + + <TextBlock Grid.Row="13" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Enforce Barcode Detection</TextBlock> + <ToggleButton IsChecked="{Binding Config.EnforceBarcodeDetection}" Grid.Row="13" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"></ToggleButton> + </Grid> + </Border> + </TabItem> + </TabControl> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs new file mode 100644 index 000000000..aa7ff5d49 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.MachineStudio.ColorCapture.ViewModels; + +namespace Tango.MachineStudio.ColorCapture.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl + { + private MainViewVM _vm; + + public MainView() + { + InitializeComponent(); + Loaded += (_, __) => + { + _vm = DataContext as MainViewVM; + }; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/packages.config new file mode 100644 index 000000000..cf3d21396 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/packages.config @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="CommonServiceLocator" version="1.3" targetFramework="net461" /> + <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> + <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net461" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" /> + <package id="MahApps.Metro" version="1.5.0" targetFramework="net461" /> + <package id="MaterialDesignColors" version="1.1.2" targetFramework="net461" /> + <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net461" /> + <package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net461" /> + <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" /> +</packages>
\ No newline at end of file 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 da97050b7..8a6c16067 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 @@ -164,10 +164,6 @@ <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\CalibrationDataView.xaml"> @@ -196,7 +192,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file 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 index ae023201c..f01637b5b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -232,6 +232,16 @@ namespace Tango.MachineStudio.ColorLab.ViewModels set { _selectedSuggestion = value; RaisePropertyChangedAuto(); OnSelectedSuggestionChanged(); } } + private bool _isHosted; + /// <summary> + /// Gets or sets a value indicating whether this instance is hosted in another view. + /// </summary> + public bool IsHosted + { + get { return _isHosted; } + set { _isHosted = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -400,12 +410,12 @@ namespace Tango.MachineStudio.ColorLab.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error in color conversion."); + LogManager.Log(ex, "An error occurred while trying to convert from source color to Volume."); - InvokeUI(() => - { - _notification.ShowError($"An error occurred while trying to convert from source color to Volume.\n" + ex.Message); - }); + //InvokeUI(() => + //{ + // _notification.ShowError($"An error occurred while trying to convert from source color to Volume.\n" + ex.Message); + //}); } }); } @@ -626,10 +636,13 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { using (_notification.PushTaskItem("Loading RML data...")) { - _dbContext.Adapter.GetConfiguration(x => x.Guid == SelectedMachine.ConfigurationGuid); + if (!IsHosted) + { + _dbContext.Adapter.GetConfiguration(x => x.Guid == SelectedMachine.ConfigurationGuid); + } _selectedRML = new RmlBuilder(_dbContext) - .Set(_selectedRML) + .Set(_selectedRML.Guid) .WithActiveParametersGroup() .WithCAT(SelectedMachine.Guid) .WithCCT() @@ -727,38 +740,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { IsFree = false; - if (_isNewCCT) - { - _dbContext.Ccts.Add(CCT); - } - - await CCT.SaveAsync(_dbContext); - - foreach (var calDataVM in LiquidsCalibrationData) - { - var cat = calDataVM.IdsPack.LiquidType.Cats.FirstOrDefault(x => x.Machine == SelectedMachine && x.Rml == SelectedRML); - - if (cat == null) - { - cat = new Cat(); - cat.Name = "untitled"; - _dbContext.Cats.Add(cat); - } - - cat.Rml = SelectedRML; - cat.Machine = SelectedMachine; - cat.LiquidType = calDataVM.IdsPack.LiquidType; - - CalibrationData calData = new CalibrationData(); - calData.LiquidType = (PMR.ColorLab.LiquidType)cat.LiquidType.Code; - calData.CalibrationPoints.AddRange(calDataVM.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); - - cat.PutCalibrationData(calData); - - await cat.SaveAsync(_dbContext); - } - - InvalidateLiquidFactorsCalibrationData(); + await SaveChanges(); } catch (Exception ex) { @@ -771,6 +753,40 @@ namespace Tango.MachineStudio.ColorLab.ViewModels } } + public async Task SaveChanges() + { + if (_isNewCCT) + { + _dbContext.Ccts.Add(CCT); + } + + foreach (var calDataVM in LiquidsCalibrationData) + { + var cat = calDataVM.IdsPack.LiquidType.Cats.FirstOrDefault(x => x.Machine == SelectedMachine && x.Rml == SelectedRML); + + if (cat == null) + { + cat = new Cat(); + cat.Name = "untitled"; + _dbContext.Cats.Add(cat); + } + + cat.Rml = SelectedRML; + cat.Machine = SelectedMachine; + cat.LiquidType = calDataVM.IdsPack.LiquidType; + + CalibrationData calData = new CalibrationData(); + calData.LiquidType = (PMR.ColorLab.LiquidType)cat.LiquidType.Code; + calData.CalibrationPoints.AddRange(calDataVM.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); + + cat.PutCalibrationData(calData); + } + + await _dbContext.SaveChangesAsync(); + + InvalidateLiquidFactorsCalibrationData(); + } + #endregion #region Override Methods @@ -782,5 +798,21 @@ namespace Tango.MachineStudio.ColorLab.ViewModels } #endregion + + public void InitHost(ObservablesContext context, Machine machine, IEnumerable<Rml> rmls, Rml selectedRml) + { + _dbContext = context; + _selectedMachine = machine; + + Rmls = new ObservableCollection<Rml>(rmls); + _selectedRML = selectedRml; + + RaisePropertyChanged(nameof(SelectedMachine)); + RaisePropertyChanged(nameof(SelectedRML)); + HiveSuggestions = new List<ColorConversionSuggestion>(); + CalibrationDataViewVM = new CalibrationDataViewVM(_notification); + + InvalidateLiquidFactorsCalibrationData(); + } } } 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 19fa9ebe6..7a2aba71e 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 @@ -14,7 +14,6 @@ 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" @@ -28,17 +27,39 @@ <converters:ObjectToObjectTypeConverter x:Key="ObjectToObjectTypeConverter" /> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <converters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> </UserControl.Resources> <Grid> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Margin" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsHosted}" Value="True"> + <Setter Property="Margin" Value="-30 0 -10 0"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Grid.ColumnDefinitions> <ColumnDefinition Width="500"/> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> - <Grid Background="#B1FFFFFF" IsEnabled="{Binding IsFree}"> + <Grid IsEnabled="{Binding IsFree}"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Background" Value="#B1FFFFFF"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsHosted}" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> <DockPanel> - <Grid DockPanel.Dock="Bottom" Margin="20"> + <Grid DockPanel.Dock="Bottom" Margin="20" Visibility="{Binding IsHosted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <Button Height="60" Command="{Binding SaveCommand}" Width="200" HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="ContentSaveSettings"></materialDesign:PackIcon> @@ -48,18 +69,21 @@ </Grid> <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 Visibility="{Binding IsHosted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <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> + </StackPanel> + + <commonControls:MachineView Width="500" 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" IsEnabled="{Binding SelectedMachine,Converter={StaticResource NullObjectToBooleanConverter}}"> @@ -109,13 +133,13 @@ <Grid Grid.Column="1"> <Grid> <Grid.RowDefinitions> - <RowDefinition Height="135" /> + <RowDefinition Height="Auto" /> <RowDefinition Height="Auto"/> <RowDefinition Height="1*" /> </Grid.RowDefinitions> <Grid> - <Grid Margin="10 10 10 0"> + <Grid Margin="10 10 10 0" Height="135" Visibility="{Binding IsHosted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <StackPanel HorizontalAlignment="Left" Margin="20 0 0 0"> <TextBlock Margin="0 0 0 0" FontSize="20" TextAlignment="Left">COLOR ADJUSTMENT DATA</TextBlock> <Grid> @@ -123,7 +147,7 @@ <materialDesign:PackIcon Kind="ArrowLeftBoldHexagonOutline" VerticalAlignment="Center" Width="40" Height="40" /> <Image Source="../Images/data-table.png" Height="80" Opacity="0.8"></Image> <StackPanel VerticalAlignment="Center" Width="300" Margin="10 0 0 0"> - + <TextBox IsReadOnly="False" Margin="0 5 0 0" Text="{Binding CCT.ForwardFileName}" HorizontalContentAlignment="Center"></TextBox> <UniformGrid Columns="2" Margin="0 5 0 0" HorizontalAlignment="Right"> <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Command="{Binding ImportForwardDataCommand}"> @@ -145,7 +169,7 @@ </StackPanel> </Grid> - <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle> + <Rectangle VerticalAlignment="Bottom" Stroke="Silver" Visibility="{Binding IsHosted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></Rectangle> </Grid> <Grid Grid.Row="1" Margin="0 40 0 0" HorizontalAlignment="Center"> @@ -278,6 +302,19 @@ </hive:HexList.ItemTemplate> </hive:HexList> + <TextBlock FontSize="40" Foreground="#FF5F5F" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2" Grid.Row="1" Text="NO INPUT"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HiveSuggestions.Count}" Value="0"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + <Image Source="../Images/arrow-long-right.png" Grid.Column="3" Grid.Row="1" Width="120" Stretch="Fill" Height="30" Opacity="0.8" Margin="20 0 20 0"></Image> <Grid Grid.Column="4" Grid.Row="1" IsHitTestVisible="False"> @@ -414,7 +451,9 @@ </Grid> <Grid Margin="0 20 0 0" IsEnabled="{Binding IsFree}"> - <local:CalibrationDataView DataContext="{Binding CalibrationDataViewVM}"></local:CalibrationDataView> + <ScrollViewer x:Name="calibrationDataScrollViewer" ScrollChanged="calibrationDataScrollViewer_ScrollChanged" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" Margin="15 0 20 0"> + <local:CalibrationDataView DataContext="{Binding CalibrationDataViewVM}"></local:CalibrationDataView> + </ScrollViewer> </Grid> </DockPanel> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs index 37dd61b18..f40ac2a2f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs @@ -34,5 +34,10 @@ namespace Tango.MachineStudio.ColorLab.Views { _vm = DataContext as MainViewVM; } + + private void calibrationDataScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) + { + //liquidsFactorsScrollViewer.ScrollToHorizontalOffset(e.HorizontalOffset); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/app.config index 96b77fa8f..8d0c46fa1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/app.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,27 +28,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -74,6 +74,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/App.config index 7d3d4b2ec..fdc15d046 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/App.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/App.config @@ -26,7 +26,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -34,27 +34,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -80,6 +80,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs index 3d282367a..bbe5432e9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs @@ -174,6 +174,11 @@ namespace Tango.MachineStudio.DataCapture.ViewModels #region Constructors + public MainViewVM() + { + + } + /// <summary> /// Initializes a new instance of the <see cref="MainViewVM"/> class. /// </summary> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config index fa31bbb95..ff251eb7d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,31 +28,31 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -78,6 +78,14 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs new file mode 100644 index 000000000..ee570ac34 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs @@ -0,0 +1,285 @@ +using MaterialDesignThemes.Wpf; +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Shapes; +using Tango.PMR.Printing; + +namespace Tango.MachineStudio.Developer.Controls +{ + public class JobOutlineControl : Control + { + #region members + private Size _sizeControl = new Size(0, 0); + ScrollViewer _parentScrollViewer = null; + public struct LevelOffset + { + public const double level_0 = 0.0; + public const double level_1 = 10.0; + public const double level_2 = 20.0; + public const double level_3 = 37.0; + public const double level_4 = 50.0; + public const double level_5 = 60.0; + public const double level_6 = 77.0; + public const double level_7 = 90.0; + public const double level_8 = 100.0; + } + private double _verticalOffset = 0; + private double _viewportHeight = 0; + private const double HEADER_FONT_HEIGHT = 35; + private const double TITLE_FONT_HEIGHT = 22; + private const double SUB_TITLE_FONT_HEIGHT = 19; + private const double NORMAL_FONT_HEIGHT = 17; + private const double WIDTH = 330; + + #endregion members + + public JobOutlineControl() : base() + { + Unloaded += JobOutlineControl_Unloaded; + DataContextChanged += JobOutlineControl_DataContextChanged; + Width = WIDTH; + } + + private void JobOutlineControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if (_parentScrollViewer != null) + { + _parentScrollViewer.ScrollToTop(); + } + + InvalidateVisual(); + } + + #region events + private void JobOutlineControl_Unloaded(object sender, RoutedEventArgs e) + { + if (_parentScrollViewer == null) + { + _parentScrollViewer.ScrollChanged -= ScrollViewer_ScrollChanged; + } + } + + private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) + { + if (e.VerticalChange == 0.0) + return; + + _verticalOffset = _parentScrollViewer.VerticalOffset; + _viewportHeight = _parentScrollViewer.ViewportHeight; + InvalidateVisual(); + } + #endregion events + #region render + protected override void OnRender(DrawingContext drawingContext) + { + base.OnRender(drawingContext); + + if (!(DataContext is JobTicket job)) return; + if (_parentScrollViewer == null) + { + _parentScrollViewer = this.FindAncestor<ScrollViewer>(); + _parentScrollViewer.ScrollChanged += ScrollViewer_ScrollChanged; + } + else if (_viewportHeight == 0) + { + _viewportHeight = _parentScrollViewer.ActualHeight; + } + _sizeControl = new Size(); + _sizeControl.Height += 10; + DrawHeaderText(drawingContext, "JOB OUTLINE", 30, LevelOffset.level_0); + _sizeControl.Height += HEADER_FONT_HEIGHT; + + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "BASIC", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + var basicProps = GetNameValueList(job); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, PackIconKind.Pencil); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + //JobTicket.Spool + if (job.Spool != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "SPOOL", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.Spool); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, PackIconKind.Pencil); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } + //JobTicket.ProcessParameters + if (job.ProcessParameters != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "PROCESS PARAMETERS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.ProcessParameters); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, PackIconKind.Settings); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } + //JobTicket.Segments + if (job.Segments != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "SEGMENTS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 10.0; + int index = 0; + foreach (JobSegment seg in job.Segments) + { + DrawHeaderText(drawingContext, string.Format("#{0} SEGMENT", ++index), 14, LevelOffset.level_1); + _sizeControl.Height += SUB_TITLE_FONT_HEIGHT; + basicProps = GetNameValueList(seg); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_2, PackIconKind.Pencil); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + //BrushStops + DrawHeaderText(drawingContext, "BRUSH STOPS", 12, LevelOffset.level_3); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + int indexBrush = 0; + foreach (JobBrushStop brushstop in seg.BrushStops) + { + _sizeControl.Height += 5.0; + DrawHeaderText(drawingContext, string.Format("#{0} STOP", ++indexBrush), 11, LevelOffset.level_4); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + var brushStops = GetNameValueList(brushstop); + foreach (var brushstopprop in brushStops) + { + DrawNameValueText(drawingContext, brushstopprop, LevelOffset.level_5, PackIconKind.Pencil); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + DrawHeaderText(drawingContext, "DISPENSERS", 12, LevelOffset.level_6); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + _sizeControl.Height += 5.0; + int indexDispenser = 0; + foreach (JobDispenser disp in brushstop.Dispensers) + { + DrawHeaderText(drawingContext, string.Format("#{0} DISPENSER", ++indexDispenser), 11, LevelOffset.level_6); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + var dispProperties = GetNameValueList(disp); + foreach (var dispprop in dispProperties) + { + DrawNameValueText(drawingContext, dispprop, LevelOffset.level_7, PackIconKind.ArrowRightBoldCircle); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } + } + } + } + + if (Height != _sizeControl.Height) + { + Height = _sizeControl.Height; + } + } + public IEnumerable<Tuple<String, String>> GetNameValueList(object value) + { + if (value != null) + { + var properties = value.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => (!x.PropertyType.IsClass && !typeof(IEnumerable).IsAssignableFrom(x.PropertyType)) || x.PropertyType == typeof(String)).ToList(); + return properties.Select(x => new Tuple<string, string>(x.Name, x.GetValue(value).ToString())); + } + else + { + return null; + } + } + #endregion render + #region drawing + protected void DrawNameValueText(DrawingContext drawingContext, Tuple<string, string> text, double levelOfOffset, PackIconKind? icon) + { + if (IsInViewPort()) + { + FormattedText formattedName = new FormattedText(text.Item1 + ": ", System.Globalization.CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal), + 12, Foreground); + DrawIconTextIfVisible(drawingContext, levelOfOffset, formattedName, icon); + double widthOfNameText = formattedName.WidthIncludingTrailingWhitespace + 17 + levelOfOffset;//17 pix for draw icon before text + + FormattedText formattedValue = new FormattedText(text.Item2, System.Globalization.CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.SemiBold, FontStretches.Normal), + 12, Foreground); + DrawIconTextIfVisible(drawingContext, widthOfNameText, formattedValue); + _sizeControl.Width = Math.Max(_sizeControl.Width, (widthOfNameText + formattedValue.WidthIncludingTrailingWhitespace)); + } + } + + private bool IsInViewPort() + { + return (_sizeControl.Height >= _verticalOffset && _sizeControl.Height <= (_verticalOffset + _viewportHeight + 5)); + } + + protected void DrawHeaderText(DrawingContext drawingContext, string text, int fontSize, double levelOfOffset) + { + if (IsInViewPort()) + { + FormattedText formattedtext = new FormattedText(text, System.Globalization.CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.SemiBold, FontStretches.Normal), + fontSize, Foreground); + DrawIconTextIfVisible(drawingContext, levelOfOffset, formattedtext); + _sizeControl.Width = Math.Max(_sizeControl.Width, (formattedtext.Width + levelOfOffset)); + } + } + + private void DrawIconTextIfVisible(DrawingContext drawingContext, double levelOfOffset, FormattedText formattedText, PackIconKind? icon = null) + { + if (icon is PackIconKind) + { + DrawIcon(drawingContext, (PackIconKind)icon, new Point(levelOfOffset, _sizeControl.Height)); + levelOfOffset += 17; + } + drawingContext.DrawText(formattedText, new Point(levelOfOffset, _sizeControl.Height)); + } + private void DrawIcon(DrawingContext drawingContext, PackIconKind kind, Point point) + { + GeometryGroup group = GetGeometryByIcon(kind); + SetGeometryPosition(group, point); + drawingContext.DrawGeometry(Foreground, new Pen(Brushes.White, 1), group); + + } + private GeometryGroup GetGeometryByIcon(PackIconKind kind) + { + PackIcon icon = new PackIcon { Kind = kind }; + Geometry geometry = Geometry.Parse(icon.Data); + GeometryGroup group = new GeometryGroup(); + group.Children.Add(geometry); + + TransformGroup tg = new TransformGroup(); + tg.Children.Add(new ScaleTransform() + { + ScaleX = 10d / geometry.Bounds.Width, + ScaleY = 10d / geometry.Bounds.Height, + }); + tg.Children.Add(new TranslateTransform() { }); + + group.Transform = tg; + return group; + } + private void SetGeometryPosition(GeometryGroup group, Point point) + { + TransformGroup tg = group.Transform as TransformGroup; + (tg.Children[1] as TranslateTransform).X = point.X; + (tg.Children[1] as TranslateTransform).Y = point.Y + 1; + } + #endregion drawing + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs index e59141e7f..5939bfd53 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs @@ -14,8 +14,15 @@ namespace Tango.MachineStudio.Developer.Converters { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - IEnumerable<LiquidVolume> liquid_volumes = value as IEnumerable<LiquidVolume>; - return liquid_volumes.SingleOrDefault(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.Lubricant.ToInt32()); + if (value != null) + { + IEnumerable<LiquidVolume> liquid_volumes = value as IEnumerable<LiquidVolume>; + return liquid_volumes.SingleOrDefault(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.Lubricant.ToInt32()); + } + else + { + return null; + } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/StringToEllipsisConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/StringToEllipsisConverter.cs new file mode 100644 index 000000000..2a14bce1e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/StringToEllipsisConverter.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class StringToEllipsisConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + String text = value as String; + int length = 0; + + if (text != null && parameter != null && int.TryParse(parameter.ToString(), out length)) + { + return text.Ellipsis(length); + } + + return String.Empty; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index c2bdf669c..cd00557b1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -93,6 +93,7 @@ <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Compile Include="Controls\JobOutlineControl.cs" /> <Compile Include="Converters\BrushStopLabToColorConverter.cs" /> <Compile Include="Converters\BrushStopCMYKToColorConverter.cs" /> <Compile Include="Converters\BrushStopToColorConverter.cs" /> @@ -112,6 +113,7 @@ <Compile Include="Converters\SegmentToBrushConverterMulti.cs" /> <Compile Include="Converters\SegmentToGradientStopsConverterMulti.cs" /> <Compile Include="Converters\SegmentToGradientStopsConverter.cs" /> + <Compile Include="Converters\StringToEllipsisConverter.cs" /> <Compile Include="DeveloperModule.cs" /> <Compile Include="DeveloperModuleSettings.cs" /> <Compile Include="Navigation\DeveloperNavigationManager.cs" /> @@ -194,10 +196,6 @@ <Project>{37e4ceab-b54b-451f-b535-04cf7da9c459}</Project> <Name>ColorMine</Name> </ProjectReference> - <ProjectReference Include="..\..\..\SideChains\RealTimeGraphEx\RealTimeGraphEx.csproj"> - <Project>{b9ae25d6-be35-492f-9079-21a7f3e6f7cc}</Project> - <Name>RealTimeGraphEx</Name> - </ProjectReference> <ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj"> <Project>{BB2ABB74-BA58-4812-83AA-EC8171F42DF4}</Project> <Name>Tango.AutoComplete</Name> @@ -337,9 +335,7 @@ <ItemGroup> <Resource Include="Images\black-screen.jpg" /> </ItemGroup> - <ItemGroup> - <Folder Include="Controls\" /> - </ItemGroup> + <ItemGroup /> <ItemGroup> <Resource Include="Images\thread.png" /> </ItemGroup> @@ -361,7 +357,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 35aca807c..4d8ec954e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -46,6 +46,7 @@ using System.Data.Entity; using System.Runtime.ExceptionServices; using Tango.BL.Builders; using Tango.MachineStudio.Common.Navigation; +using System.Diagnostics; namespace Tango.MachineStudio.Developer.ViewModels { @@ -78,6 +79,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private bool _dialog_shown; private bool _disable_gamut_check; private bool _rml_has_no_cct; + private TaskItem _preparingTaskItem; #region Properties @@ -739,8 +741,8 @@ namespace Tango.MachineStudio.Developer.ViewModels RemoveBrushStopCommand = new RelayCommand(RemoveSelectedBrushStops, () => SelectedBrushStop != null && CanWork); SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null && CanWork); DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null && CanWork); - StartJobCommand = new RelayCommand(() => StartJob(), () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.Actions.Contains(BL.Enumerations.EventTypeActions.PreventJob))); - StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.Actions.Contains(BL.Enumerations.EventTypeActions.PreventJob))); + StartJobCommand = new RelayCommand(() => StartJob(), () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null); + StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && CanWork); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning && CanWork); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); LoadJobCommand = new RelayCommand(() => LoadSelectedJob(), () => SelectedMachineJob != null && CanWork); @@ -956,6 +958,31 @@ namespace Tango.MachineStudio.Developer.ViewModels MachineOperator.ResumingJob -= MachineOperator_ResumingJob; MachineOperator.ResumingJob += MachineOperator_ResumingJob; + + MachineOperator.PreparingJobProgress -= MachineOperator_PreparingJobProgress; + MachineOperator.PreparingJobProgress += MachineOperator_PreparingJobProgress; + } + } + + private void MachineOperator_PreparingJobProgress(object sender, PreparingJobProgressEventArgs e) + { + var percent = (e.Progress / e.Total * 100d); + + if (_preparingTaskItem == null && percent == 0) + { + _preparingTaskItem = _notification.PushTaskItem("Preparing job for printing..."); + } + else if (percent == 100) + { + _preparingTaskItem.Pop(); + _preparingTaskItem = null; + } + else + { + if (_preparingTaskItem != null) + { + _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%..."; + } } } @@ -991,6 +1018,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private void MachineEventsStateProvider_EventsChanged(object sender, IEnumerable<MachinesEvent> changedEvents) { InvokeUI(StartJobCommand.RaiseCanExecuteChanged); + InvokeUI(StartJobAndRecordCommand.RaiseCanExecuteChanged); } /// <summary> @@ -1277,7 +1305,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <summary> /// Starts the job. /// </summary> - private void StartJob(Func<Job, JobHandler> resumeFunc = null) + private async void StartJob(Func<Job, JobHandler> resumeFunc = null) { LogManager.Log(String.Format("Starting job {0}...", ActiveJob.Name)); if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected) @@ -1301,28 +1329,29 @@ namespace Tango.MachineStudio.Developer.ViewModels IsJobFailed = false; IsJobCanceled = false; IsJobCompleted = false; - IsJobRunning = true; - ShowJobStatus = true; RunningJob = ActiveJob; _runningJobEstimatedDuration = EstimatedDuration; RunningJobSegments = RunningJob.EffectiveSegments.ToList(); - _navigation.NavigateTo(DeveloperNavigationView.RunningJobView); - try { + IsFree = false; LogManager.Log("Sending job to machine operator..."); if (resumeFunc == null) { - JobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + JobHandler = await MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); } else { JobHandler = resumeFunc(ActiveJob); } + _navigation.NavigateTo(DeveloperNavigationView.RunningJobView); + IsJobRunning = true; + ShowJobStatus = true; + _eventLogger.Log(String.Format("Job '{0}' started...", ActiveJob.Name)); JobHandler.StatusChanged += (x, status) => @@ -1367,7 +1396,7 @@ namespace Tango.MachineStudio.Developer.ViewModels InvokeUI(() => { - _notification.ShowError("Job failed. " + ex.Message); + _notification.ShowError("Job failed. " + ex.FlattenMessage()); StopRecordingIfInProgress(); }); }; @@ -1389,6 +1418,12 @@ namespace Tango.MachineStudio.Developer.ViewModels JobHandler.Canceled += (x, y) => { + if (_preparingTaskItem != null) + { + _preparingTaskItem.Pop(); + _preparingTaskItem = null; + } + LogManager.Log(String.Format("Job {0} has been canceled.", RunningJob.Name)); _eventLogger.Log(String.Format("Job {0} has been canceled.", RunningJob.Name)); StopRecordingIfInProgress(); @@ -1403,6 +1438,10 @@ namespace Tango.MachineStudio.Developer.ViewModels SetJobFailed(); StopRecordingIfInProgress(); } + finally + { + IsFree = true; + } } /// <summary> @@ -1483,14 +1522,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.Log("Invalidating liquid factors, process parameters and process group history..."); - if (_selectedRML != ActiveJob.Rml) - { - _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().Build(); - } - else - { - _selectedRML = ActiveJob.Rml; - } + _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().Build(); if (_selectedRML.Ccts.Count == 0) { @@ -2077,7 +2109,7 @@ namespace Tango.MachineStudio.Developer.ViewModels newJob.ColorSpace = _machineDbContext.ColorSpaces.FirstOrDefault(); newJob.Machine = SelectedMachine; - + SelectedMachine.Jobs.Add(newJob); var segment = newJob.AddSolidSegment(); @@ -2156,6 +2188,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { var cloned = stop.Clone(); cloned.StopIndex = SelectedSegment.BrushStops.Max(x => x.StopIndex) + 1; + cloned.SetLiquidVolumes(ActiveJob.Machine.Configuration, SelectedRML, SelectedProcessParametersTable); SelectedSegment.BrushStops.Add(cloned); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 1057f7c84..a5d137e67 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -432,7 +432,7 @@ </UserControl.Resources> - <Grid> + <Grid IsEnabled="{Binding IsFree}"> <Grid Grid.Row="1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> @@ -865,9 +865,15 @@ </StackPanel> <DockPanel> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" VerticalAlignment="Center" Margin="0 0 15 0"> - <ToggleButton IsChecked="{Binding EnableColorConversion}" /> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Foreground="DimGray">Enable Color Conversion</TextBlock> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" VerticalAlignment="Center" Margin="0 0 0 0"> + <TextBlock VerticalAlignment="Center" Foreground="DimGray">Generate Gradient</TextBlock> + <ToggleButton Margin="10 0 0 0" IsChecked="{Binding ApplicationManager.ConnectedMachine.GradientGenerationConfiguration.IsEnabled,Mode=TwoWay}" /> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Foreground="DimGray">Resolution:</TextBlock> + <mahapps:NumericUpDown HideUpDownButtons="True" Width="90" HorizontalAlignment="Left" FontSize="14" FontFamily="{StaticResource digital-7}" StringFormat="{}{0:N0} cm" Margin="5 1 0 0" Minimum="10" Maximum="1000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding MachineOperator.GradientGenerationConfiguration.ResolutionCM,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> + <mahapps:NumericUpDown.Resources> + <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> </StackPanel> <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="15" Margin="200 0 10 0" StrokeThickness="1" Stroke="Gainsboro"> <Rectangle.Fill> @@ -962,11 +968,11 @@ <Run FontFamily="{StaticResource digital-7}" Text="{Binding OffsetPercent,StringFormat={}{0:F1}%}"></Run> <Run FontSize="12" Foreground="Gray" Text="{Binding OffsetMeters,Mode=OneWay,StringFormat={} ( {0:F1}m )}"></Run> </TextBlock> - <Slider ValueChanged="Offset_Slider_ValueChanged" Style="{StaticResource GradientOffsetSlider}" SmallChange="0.1" IsSnapToTickEnabled="True" TickFrequency="0.1" Margin="0 20 0 0" HorizontalAlignment="Center" Width="300" Value="{Binding OffsetPercent}" IsEnabled="{Binding IsMiddle}"> + <Slider ValueChanged="Offset_Slider_ValueChanged" Style="{StaticResource GradientOffsetSlider}" SmallChange="0.1" IsSnapToTickEnabled="True" TickFrequency="0.1" Margin="0 20 0 0" HorizontalAlignment="Center" Width="300" Value="{Binding OffsetPercent}" IsEnabled="{Binding IsMiddle}" Minimum="0" Maximum="100"> <Slider.Foreground> <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> </Slider.Foreground> - <Slider.Minimum> + <!--<Slider.Minimum> <MultiBinding Converter="{StaticResource BrushStopToOffsetLimitConverter}" ConverterParameter="min"> <Binding Path="."></Binding> <Binding RelativeSource="{RelativeSource AncestorType=UserControl,Mode=FindAncestor}" Path="DataContext.SelectedSegment"></Binding> @@ -979,7 +985,7 @@ <Binding RelativeSource="{RelativeSource AncestorType=UserControl,Mode=FindAncestor}" Path="DataContext.SelectedSegment"></Binding> <Binding Path="StopIndex"></Binding> </MultiBinding> - </Slider.Maximum> + </Slider.Maximum>--> </Slider> </StackPanel> </Grid> @@ -1214,7 +1220,7 @@ </Grid> <Grid DockPanel.Dock="Right" Margin="0 0 10 0"> - <StackPanel Orientation="Horizontal" Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <StackPanel Orientation="Horizontal" Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityInverseConverter}}" IsEnabled="{Binding MachineOperator.CanPrint}"> <Button Height="60" Width="280" Command="{Binding StartJobCommand}" Click="OnJobStartClick"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon VerticalAlignment="Center" Width="32" Height="32" Kind="ClockFast" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml index 16d312da4..dbe0d835b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml @@ -8,6 +8,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" xmlns:global="clr-namespace:Tango.MachineStudio.Developer" + xmlns:controls="clr-namespace:Tango.MachineStudio.Developer.Controls" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> @@ -16,6 +17,7 @@ <converters:DateTimeUTCToStringConverter x:Key="DateTimeUTCToStringConverter" /> <localConverters:ObjectToPropertiesConverter x:Key="ObjectToPropertiesConverter" /> <converters:MathOperatorConverter x:Key="MathOperatorConverter" /> + <localConverters:StringToEllipsisConverter x:Key="StringToEllipsisConverter" /> </UserControl.Resources> <Grid> @@ -192,13 +194,7 @@ <DataGridTextColumn SortDirection="Descending" Header="DATE TIME" Binding="{Binding DateTime,Converter={StaticResource DateTimeUTCToStringConverter},ConverterParameter='MM/dd/yyyy HH:mm:ss.fff'}" /> <DataGridTextColumn Header="GROUP" Binding="{Binding EventType.Group}" /> <DataGridTextColumn Header="EVENT" Binding="{Binding EventType.Title}" /> - <DataGridTemplateColumn Header="MESSAGE" Width="1*"> - <DataGridTemplateColumn.CellTemplate> - <DataTemplate> - <TextBlock Text="{Binding Description}" TextTrimming="CharacterEllipsis"></TextBlock> - </DataTemplate> - </DataGridTemplateColumn.CellTemplate> - </DataGridTemplateColumn> + <DataGridTextColumn Header="MESSAGE" Width="1*" Binding="{Binding Description,Converter={StaticResource StringToEllipsisConverter},ConverterParameter=100}" /> </DataGrid.Columns> </DataGrid> </Grid> @@ -207,158 +203,25 @@ </Grid> <Grid HorizontalAlignment="Right"> - <ContentControl> + <ContentControl Content="{Binding}"> <ContentControl.Style> <Style TargetType="ContentControl"> <Setter Property="Visibility" Value="Collapsed"></Setter> - <Setter Property="Content" Value="{x:Null}"></Setter> + <Setter Property="ContentTemplate" Value="{x:Null}"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=toggleOutline,Path=IsChecked}" Value="True"> <Setter Property="Visibility" Value="Visible"></Setter> - <Setter Property="Content"> + <Setter Property="ContentTemplate"> <Setter.Value> - <Border BorderBrush="Gray" BorderThickness="1 0 0 0" Background="White"> - <Grid> - <ScrollViewer Padding="20" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True"> - <StackPanel> - <TextBlock Text="JOB OUTLINE" HorizontalAlignment="Center" Margin="0 10 0 0" FontSize="30"></TextBlock> - - <TextBlock FontSize="17" FontWeight="SemiBold" Margin="0 20 0 0">BASIC</TextBlock> - <ItemsControl Margin="10 0 0 0" ItemsSource="{Binding JobHandler.JobTicket,Converter={StaticResource ObjectToPropertiesConverter}}" VirtualizingPanel.IsVirtualizing="True"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> - <materialDesign:PackIcon Kind="Pencil" Width="12" Height="12" VerticalAlignment="Center" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"> - <Run Text="{Binding Name,Mode=OneWay}"></Run><Run>:</Run> - <Run Text="{Binding Value,Mode=OneWay}" FontWeight="SemiBold"></Run> - </TextBlock> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - - <TextBlock FontSize="17" FontWeight="SemiBold" Margin="0 20 0 0">SPOOL</TextBlock> - <ItemsControl Margin="10 0 0 0" ItemsSource="{Binding JobHandler.JobTicket.Spool,Converter={StaticResource ObjectToPropertiesConverter}}" VirtualizingPanel.IsVirtualizing="True"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> - <materialDesign:PackIcon Kind="Pencil" Width="12" Height="12" VerticalAlignment="Center" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"> - <Run Text="{Binding Name,Mode=OneWay}"></Run><Run>:</Run> - <Run Text="{Binding Value,Mode=OneWay}" FontWeight="SemiBold"></Run> - </TextBlock> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - - <TextBlock FontSize="17" FontWeight="SemiBold" Margin="0 20 0 0">PROCESS PARAMETERS</TextBlock> - <ItemsControl Margin="10 0 0 0" ItemsSource="{Binding JobHandler.JobTicket.ProcessParameters,Converter={StaticResource ObjectToPropertiesConverter}}" VirtualizingPanel.IsVirtualizing="True"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> - <materialDesign:PackIcon Kind="Settings" Width="12" Height="12" VerticalAlignment="Center" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"> - <Run Text="{Binding Name,Mode=OneWay}"></Run><Run>:</Run> - <Run Text="{Binding Value,Mode=OneWay}" FontWeight="SemiBold"></Run> - </TextBlock> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - - <TextBlock FontSize="17" FontWeight="SemiBold" Margin="0 20 0 0">SEGMENTS</TextBlock> - <ItemsControl Margin="10 0 0 0" ItemsSource="{Binding JobHandler.JobTicket.Segments}" AlternationCount="10000" VirtualizingPanel.IsVirtualizing="True"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <Expander IsExpanded="False" Background="Transparent"> - <Expander.Header> - <TextBlock FontSize="14" FontWeight="SemiBold"> - <Run>#</Run><Run Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(ItemsControl.AlternationIndex),Mode=OneWay,Converter={StaticResource MathOperatorConverter},ConverterParameter='+1'}"></Run> - <Run Text="SEGMENT"></Run> - </TextBlock> - </Expander.Header> - <StackPanel> - - <ItemsControl Margin="10 0 0 0" ItemsSource="{Binding Converter={StaticResource ObjectToPropertiesConverter}}" VirtualizingPanel.IsVirtualizing="True"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> - <materialDesign:PackIcon Kind="Pencil" Width="12" Height="12" VerticalAlignment="Center" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"> - <Run Text="{Binding Name,Mode=OneWay}"></Run><Run>:</Run> - <Run Text="{Binding Value,Mode=OneWay}" FontWeight="SemiBold"></Run> - </TextBlock> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - - <TextBlock FontSize="12" FontWeight="SemiBold" Margin="27 10 0 0">BRUSH STOPS</TextBlock> - <ItemsControl Margin="40 0 0 0" ItemsSource="{Binding BrushStops}" AlternationCount="10000" VirtualizingPanel.IsVirtualizing="True"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel> - <TextBlock FontSize="11" FontWeight="SemiBold" Margin="0 5 0 0"> - <Run>#</Run><Run Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(ItemsControl.AlternationIndex),Mode=OneWay,Converter={StaticResource MathOperatorConverter},ConverterParameter='+1'}"></Run> - <Run Text="STOP"></Run> - </TextBlock> - - <ItemsControl Margin="10 0 0 0" ItemsSource="{Binding Converter={StaticResource ObjectToPropertiesConverter}}" VirtualizingPanel.IsVirtualizing="True"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> - <materialDesign:PackIcon Kind="Pencil" Width="12" Height="12" VerticalAlignment="Center" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"> - <Run Text="{Binding Name,Mode=OneWay}"></Run><Run>:</Run> - <Run Text="{Binding Value,Mode=OneWay}" FontWeight="SemiBold"></Run> - </TextBlock> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - - <TextBlock FontSize="12" FontWeight="SemiBold" Margin="27 10 0 0">DISPENSERS</TextBlock> - <ItemsControl Margin="40 0 0 0" ItemsSource="{Binding Dispensers}" AlternationCount="10000" VirtualizingPanel.IsVirtualizing="True"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel> - <TextBlock FontSize="11" FontWeight="SemiBold" Margin="0 5 0 0"> - <Run>#</Run><Run Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(ItemsControl.AlternationIndex),Mode=OneWay,Converter={StaticResource MathOperatorConverter},ConverterParameter='+1'}"></Run> - <Run Text="DISPENSER"></Run> - </TextBlock> - - <ItemsControl Margin="10 0 0 0" ItemsSource="{Binding Converter={StaticResource ObjectToPropertiesConverter}}" VirtualizingPanel.IsVirtualizing="True"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> - <materialDesign:PackIcon Kind="ArrowRightBoldCircle" Width="12" Height="12" VerticalAlignment="Center" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"> - <Run Text="{Binding Name,Mode=OneWay}"></Run><Run>:</Run> - <Run Text="{Binding Value,Mode=OneWay}" FontWeight="SemiBold"></Run> - </TextBlock> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </StackPanel> - </Expander> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </StackPanel> - </ScrollViewer> - </Grid> - </Border> + <DataTemplate> + <Border BorderBrush="Gray" BorderThickness="1 0 0 0" Background="White"> + <Grid> + <ScrollViewer Padding="20" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"> + <controls:JobOutlineControl HorizontalAlignment="Left" DataContext="{Binding JobHandler.JobTicket}" VirtualizingStackPanel.IsVirtualizing="True"/> + </ScrollViewer> + </Grid> + </Border> + </DataTemplate> </Setter.Value> </Setter> </DataTrigger> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config index fa31bbb95..ff251eb7d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,31 +28,31 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -78,6 +78,14 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/app.config index 96b77fa8f..8d0c46fa1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/app.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,27 +28,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -74,6 +74,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config index f66a052ae..a8d9dbc13 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config @@ -26,7 +26,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -34,31 +34,31 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -84,6 +84,14 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file 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 6ae893e72..d5ad86e2a 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 @@ -81,6 +81,9 @@ <Compile Include="ViewModels\MachineCreationDialogVM.cs" /> <Compile Include="ViewModels\MachineVersionDialogVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\ColorCalibrationView.xaml.cs"> + <DependentUpon>ColorCalibrationView.xaml</DependentUpon> + </Compile> <Compile Include="Views\MachineCreationDialog.xaml.cs"> <DependentUpon>MachineCreationDialog.xaml</DependentUpon> </Compile> @@ -109,6 +112,10 @@ <Compile Include="Views\SpoolsView.xaml.cs"> <DependentUpon>SpoolsView.xaml</DependentUpon> </Compile> + <Page Include="Views\ColorCalibrationView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\MachineCreationDialog.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -230,6 +237,10 @@ <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.ColorLab\Tango.MachineStudio.ColorLab.csproj"> + <Project>{4d183aca-552b-4135-ae81-7c5a8e5fc3b1}</Project> + <Name>Tango.MachineStudio.ColorLab</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Resource Include="Images\machine-full-fx.png" /> @@ -276,7 +287,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file 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 22bf03148..15033e295 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 @@ -112,6 +112,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels set { _selectedSpool = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + private ColorLab.ViewModels.MainViewVM _colorLabVM; + public ColorLab.ViewModels.MainViewVM ColorLabVM + { + get { return _colorLabVM; } + set { _colorLabVM = value; RaisePropertyChangedAuto(); } + } #endregion @@ -162,6 +168,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// </summary> public RelayCommand RemoveSpoolCommand { get; set; } + /// <summary> + /// Gets or sets the clone machine command. + /// </summary> public RelayCommand CloneMachineCommand { get; set; } #endregion @@ -201,6 +210,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public override async void OnApplicationReady() { MachinesAdapter.MachineVersions = (await MachinesAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection(); + ColorLabVM = new ColorLab.ViewModels.MainViewVM(_notification) { IsHosted = true }; } #endregion @@ -419,6 +429,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } } + ColorLabVM.InitHost(ActiveMachineAdapter.Context, ActiveMachine, ActiveMachineAdapter.Rmls, ActiveMachineAdapter.Rmls.FirstOrDefault()); + View.NavigateTo(MachineDesignerNavigationView.MachineDetailsView); } catch (Exception ex) @@ -561,6 +573,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachine.ProductionDate = DateTime.UtcNow; await ActiveMachineAdapter.Context.SaveChangesAsync(); + await ColorLabVM.SaveChanges(); + if (SelectedMachine != null) { await SelectedMachine.Reload(MachinesAdapter.Context); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml new file mode 100644 index 000000000..e73c9661f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml @@ -0,0 +1,20 @@ +<UserControl x:Class="Tango.MachineStudio.MachineDesigner.Views.ColorCalibrationView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + 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:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" + xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:colorLab="clr-namespace:Tango.MachineStudio.ColorLab.Views;assembly=Tango.MachineStudio.ColorLab" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <Grid> + <colorLab:MainView DataContext="{Binding ColorLabVM}" /> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml.cs new file mode 100644 index 000000000..d617df37f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.MachineDesigner.Views +{ + /// <summary> + /// Interaction logic for ColorCalibrationView.xaml + /// </summary> + public partial class ColorCalibrationView : UserControl + { + public ColorCalibrationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml index 31e7f535b..ce60ebf02 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml @@ -42,6 +42,9 @@ <Style TargetType="TabPanel"> <Setter Property="HorizontalAlignment" Value="Center"/> </Style> + <Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="Padding" Value="20,2"></Setter> + </Style> </TabControl.Resources> <TabItem Header="SETTINGS"> <local:MachineSettingsView/> @@ -52,6 +55,9 @@ <TabItem Header="SPOOLS"> <local:SpoolsView/> </TabItem> + <TabItem Header="COLOR CALIBRATION"> + <local:ColorCalibrationView/> + </TabItem> </TabControl> </Grid> </DockPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml index c6587b564..faa6b1086 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml @@ -7,6 +7,7 @@ xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner" xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" @@ -59,7 +60,7 @@ </StackPanel> </Grid> <Grid IsEnabled="{Binding IsFree}"> - <DataGrid Margin="0 0 0 10" SelectionMode="Single" SelectionUnit="FullRow" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding MachinesAdapter.Machines}" SelectedItem="{Binding SelectedMachine}"> + <controls:DoubleClickDataGrid Style="{StaticResource {x:Type DataGrid}}" DoubleClickCommand="{Binding EditMachineCommand}" Margin="0 0 0 10" SelectionMode="Single" SelectionUnit="FullRow" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding MachinesAdapter.Machines}" SelectedItem="{Binding SelectedMachine}"> <DataGrid.CellStyle> <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> <Setter Property="BorderThickness" Value="0"/> @@ -75,7 +76,7 @@ <DataGridTextColumn Header="DEMO MACHINE" Binding="{Binding IsDemo}" Width="Auto" /> <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="1*" /> </DataGrid.Columns> - </DataGrid> + </controls:DoubleClickDataGrid> </Grid> </DockPanel> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config index fa31bbb95..ff251eb7d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,31 +28,31 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -78,6 +78,14 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config index 1f0b571a1..f2c34ddba 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,27 +28,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -74,6 +74,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config index 8ea5566ba..ed4582d5b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config @@ -22,7 +22,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -30,27 +30,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> @@ -80,6 +80,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs index fd897e811..ef9561d0b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs @@ -12,6 +12,8 @@ using Tango.BL.Enumerations; using Tango.Core.Helpers; using Tango.MachineStudio.Common; using Tango.MachineStudio.Statistics.Models; +using System.Data.Entity; +using Tango.MachineStudio.Common.Notifications; namespace Tango.MachineStudio.Statistics.ViewModels { @@ -20,6 +22,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels private ObservablesContext _context; private List<JobRun> _job_runs; private bool rendered; + private INotificationProvider _notification; + private bool _loaded; private LabeledSeriesCollection _timelineJobStatusSeries; public LabeledSeriesCollection TimelineJobStatusSeries @@ -35,24 +39,58 @@ namespace Tango.MachineStudio.Statistics.ViewModels set { _pieJobFailedReasons = value; RaisePropertyChangedAuto(); } } - public MainViewVM() + private LabeledSeriesCollection _printPerWeekSeries; + public LabeledSeriesCollection PrintPerWeekSeries { + get { return _printPerWeekSeries; } + set { _printPerWeekSeries = value; RaisePropertyChangedAuto(); } + } + + private DateTime _startDate; + public DateTime StartDate + { + get { return _startDate; } + set { _startDate = value; RaisePropertyChangedAuto(); OnDateRangeChanged(); } + } + + private DateTime _endDate; + public DateTime EndDate + { + get { return _endDate; } + set { _endDate = value; RaisePropertyChangedAuto(); OnDateRangeChanged(); } + } + + private DateTime _minDate; + public DateTime MinDate + { + get { return _minDate; } + set { _minDate = value; RaisePropertyChangedAuto(); } + } + + private DateTime _maxDate; + public DateTime MaxDate + { + get { return _maxDate; } + set { _maxDate = value; RaisePropertyChangedAuto(); } + } + + + public MainViewVM(INotificationProvider notificationProvider) + { + _notification = notificationProvider; + StartDate = DateTime.Now.AddMonths(-1); + EndDate = DateTime.Now; } public override void OnApplicationReady() { - Task.Factory.StartNew(() => - { - _context = ObservablesContext.CreateDefault(); - DateTime start_date = DateTime.UtcNow.AddMonths(-1); - _job_runs = _context.JobRuns.OrderBy(x => x.StartDate).ToList(); - }); + } - private List<JobRun> GetJobRunsByStartDate(DateTime startDate, JobRunStatus? status = null) + private List<JobRun> GetJobRunsByDateRange(DateTime startDate, DateTime endTime, JobRunStatus? status = null) { - return _job_runs.Where(x => x.StartDate.ToLocalTime() >= startDate && (status == null || x.JobRunStatus == status)).ToList(); + return _job_runs.Where(x => x.StartDate.ToLocalTime() >= startDate && x.StartDate.ToLocalTime() <= endTime && (status == null || x.JobRunStatus == status)).ToList(); } private List<JobRun> GetJobRunsByDate(DateTime date, JobRunStatus? status = null) @@ -68,7 +106,9 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } - public override void OnNavigatedTo() + + + public override async void OnNavigatedTo() { base.OnNavigatedTo(); @@ -76,21 +116,49 @@ namespace Tango.MachineStudio.Statistics.ViewModels rendered = true; - InvokeUIOnIdle(() => + + using (_notification.PushTaskItem("Loading statistics...")) { + IsFree = false; + + await Task.Factory.StartNew(() => + { + _context = ObservablesContext.CreateDefault(); + _job_runs = _context.JobRuns.Include(x => x.Job).Include(x => x.Job.Machine).OrderBy(x => x.StartDate).ToList(); + }); + if (_job_runs.Count > 0) { - GenerateTimelineJobStatusChart(); - GeneratePieFailedReasonsChart(); + MinDate = _job_runs.Min(x => x.StartDate); + MaxDate = _job_runs.Max(x => x.StartDate); } - }); + + InvokeUIOnIdle(() => + { + OnDateRangeChanged(); + }); + + _loaded = true; + + IsFree = true; + } + } + + private void OnDateRangeChanged() + { + if (_job_runs != null && _job_runs.Count > 0 && _loaded) + { + GenerateTimelineJobStatusChart(); + GeneratePieFailedReasonsChart(); + GeneratePrintPerWeekChart(); + } } private void GenerateTimelineJobStatusChart() { TimelineJobStatusSeries = new LabeledSeriesCollection() { - Title = "This Month Job Runs Status", + Title = "Job Runs Status", ChartTitle = "Number Of Runs", LabelsTitle = "Date", SeriesColors = new List<Color>() @@ -101,26 +169,62 @@ namespace Tango.MachineStudio.Statistics.ViewModels }, }; - var completed_job_runs = new ColumnSeries() + Series completed_job_runs = new ColumnSeries() { Title = "Completed", Values = new ChartValues<int>(), Fill = Brushes.Green, + MinWidth = 1, + }; - var aborted_job_runs = new ColumnSeries() + Series aborted_job_runs = new ColumnSeries() { Title = "Aborted", Values = new ChartValues<int>(), Fill = Brushes.Orange, + MinWidth = 1, }; - var failed_job_runs = new ColumnSeries() + Series failed_job_runs = new ColumnSeries() { Title = "Failed", Values = new ChartValues<int>(), Fill = Brushes.Red, + MinWidth = 1, }; - foreach (var date in CreateDates(DateTime.Now.AddMonths(-1), DateTime.Now)) + if (EndDate - StartDate > TimeSpan.FromDays(40)) + { + completed_job_runs = new LineSeries() + { + Title = "Completed", + Values = new ChartValues<int>(), + Fill = new SolidColorBrush(Colors.Green) { Opacity = 0.5 }, + MinWidth = 1, + PointGeometry = null, + StrokeThickness = 0, + + }; + aborted_job_runs = new LineSeries() + { + Title = "Aborted", + Values = new ChartValues<int>(), + Fill = new SolidColorBrush(Colors.Orange) { Opacity = 0.5 }, + MinWidth = 1, + PointGeometry = null, + StrokeThickness = 0, + }; + failed_job_runs = new LineSeries() + { + Title = "Failed", + Values = new ChartValues<int>(), + Fill = new SolidColorBrush(Colors.Red) { Opacity = 0.5 }, + MinWidth = 1, + PointGeometry = null, + StrokeThickness = 0, + }; + } + + foreach (var date in CreateDates(StartDate, EndDate)) { completed_job_runs.Values.Add(GetJobRunsByDate(date, JobRunStatus.Completed).Count()); aborted_job_runs.Values.Add(GetJobRunsByDate(date, JobRunStatus.Aborted).Count()); @@ -129,18 +233,20 @@ namespace Tango.MachineStudio.Statistics.ViewModels TimelineJobStatusSeries.Labels.Add(date.ToShortDateString()); } - TimelineJobStatusSeries.SeriesCollection.Add(completed_job_runs); - TimelineJobStatusSeries.SeriesCollection.Add(aborted_job_runs); + + TimelineJobStatusSeries.SeriesCollection.Add(failed_job_runs); + TimelineJobStatusSeries.SeriesCollection.Add(aborted_job_runs); + TimelineJobStatusSeries.SeriesCollection.Add(completed_job_runs); } private void GeneratePieFailedReasonsChart() { - var groups = GetJobRunsByStartDate(DateTime.Now.AddMonths(-1), JobRunStatus.Failed).GroupBy(x => x.FailedMessage).OrderBy(x => x.Count()); + var groups = GetJobRunsByDateRange(StartDate, EndDate, JobRunStatus.Failed).GroupBy(x => x.FailedMessage).OrderBy(x => x.Count()); List<Color> colors = new List<Color>(); - int max = groups.Max(x => x.Count()); + int max = groups.Count() > 0 ? groups.Max(x => x.Count()) : 0; for (int i = 0; i < groups.Count(); i++) { @@ -151,7 +257,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels PieJobFailedReasons = new LabeledSeriesCollection() { - Title = "This Month Job Failure Reasons", + Title = "Job Failure Reasons", SeriesColors = colors, }; @@ -173,5 +279,88 @@ namespace Tango.MachineStudio.Statistics.ViewModels PieJobFailedReasons.SeriesCollection.Add(series); } } + + private void GeneratePrintPerWeekChart() + { + List<JobRun> range_job_runs = GetJobRunsByDateRange(StartDate, EndDate); + + Dictionary<Machine, List<double>> weeks_print_avg = new Dictionary<Machine, List<double>>(); + + //Init machines weeks averages dictionary. + foreach (var machine in range_job_runs.Select(x => x.Job.Machine).OrderBy(x => x.Name).DistinctBy(x => x.Guid)) + { + weeks_print_avg[machine] = new List<double>(); + } + + //Create all available dates + List<DateTime> all_dates = range_job_runs.Select(x => x.StartDate).ToList(); + + //get first Sunday. + DateTime current_sunday = all_dates.FirstOrDefault(x => x.DayOfWeek == DayOfWeek.Sunday); + + if (current_sunday != null && all_dates.Count > 0) + { + //Iterate over each week starting from the earliest Sunday. + while (current_sunday <= all_dates.Last()) + { + var week_job_runs = range_job_runs.Where(x => x.EndPosition > 10 && x.StartDate >= current_sunday && x.StartDate <= current_sunday.AddDays(7)).ToList(); + + foreach (var machine_job_runs in week_job_runs.GroupBy(x => x.Job.Machine)) + { + weeks_print_avg[machine_job_runs.Key].Add(machine_job_runs.Select(x => x.EndPosition).Average()); + } + + current_sunday = current_sunday.AddDays(8); + } + } + + Dictionary<Machine, double> week_print_avg = new Dictionary<Machine, double>(); + + //Init machines week average dictionary. + foreach (var machine in weeks_print_avg) + { + if (machine.Value.Count > 0) + { + week_print_avg[machine.Key] = machine.Value.Average(); + } + } + + //Init chart series + PrintPerWeekSeries = new LabeledSeriesCollection() + { + Title = "Average Printed Thread Per Week (m)", + ChartTitle = "Average Print Per Week (m)", + LabelsTitle = "Date", + SeriesColors = new List<Color>() + { + + }, + }; + + //Init series colors intensity by number of prints. + double max = week_print_avg.Count > 0 ? week_print_avg.Max(x => x.Value) : 0; + foreach (var machine in week_print_avg) + { + double a = (machine.Value / max); + PrintPerWeekSeries.SeriesColors.Add(Color.FromArgb((byte)(255d * (machine.Value / max)), 0, 200, 0)); + } + + //Init columns. + int index = 0; + + foreach (var machine in week_print_avg) + { + var series = new ColumnSeries() + { + Title = machine.Key.Name, + Values = new ChartValues<int>() { (int)machine.Value }, + Fill = new SolidColorBrush(PrintPerWeekSeries.SeriesColors[index++]), + DataLabels = true, + ToolTip = machine.Key.SerialNumber, + }; + + PrintPerWeekSeries.SeriesCollection.Add(series); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml index f063c1675..69708f517 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml @@ -5,13 +5,31 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vm="clr-namespace:Tango.MachineStudio.Statistics.ViewModels" xmlns:global="clr-namespace:Tango.MachineStudio.Statistics" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Tango.MachineStudio.Statistics.Views" xmlns:tooltips="clr-namespace:Tango.MachineStudio.Statistics.Tooltips" xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - <Grid> - <UniformGrid Columns="3" Margin="50" Rows="3"> + <Grid IsEnabled="{Binding IsFree}"> + <Grid.RowDefinitions> + <RowDefinition Height="80"/> + <RowDefinition Height="337*"/> + </Grid.RowDefinitions> + + <StackPanel Margin="60 20 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal"> + <StackPanel> + <TextBlock FontSize="10">Start Date:</TextBlock> + <DatePicker DisplayDateStart="{Binding MinDate}" DisplayDateEnd="{Binding MaxDate}" SelectedDate="{Binding StartDate}" materialDesign:HintAssist.Hint="Pick start date" Width="200" VerticalAlignment="Bottom" FontSize="16"></DatePicker> + </StackPanel> + + <StackPanel Margin="40 0 0 0"> + <TextBlock FontSize="10">End Date:</TextBlock> + <DatePicker DisplayDateStart="{Binding MinDate}" DisplayDateEnd="{Binding MaxDate}" SelectedDate="{Binding EndDate}" materialDesign:HintAssist.Hint="Pick end date" Width="200" VerticalAlignment="Bottom" FontSize="16"></DatePicker> + </StackPanel> + </StackPanel> + + <UniformGrid Columns="3" Margin="50 20 50 50" Rows="2" Grid.Row="1"> <Border BorderBrush="#181818" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> <DockPanel> <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding TimelineJobStatusSeries.Title}"></TextBlock> @@ -48,6 +66,28 @@ </UniformGrid> </DockPanel> </Border> + + <Border BorderBrush="#181818" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding PrintPerWeekSeries.Title}"></TextBlock> + <lvc:CartesianChart Series="{Binding PrintPerWeekSeries.SeriesCollection}" LegendLocation="Bottom" SeriesColors="{Binding PrintPerWeekSeries.SeriesColors}"> + <lvc:CartesianChart.AxisX> + <lvc:Axis Title="{Binding PrintPerWeekSeries.LabelsTitle}" Labels="{Binding PrintPerWeekSeries.Labels}" Foreground="#202020"> + <lvc:Axis.Separator> + <lvc:Separator Stroke="#A5A5A5" /> + </lvc:Axis.Separator> + </lvc:Axis> + </lvc:CartesianChart.AxisX> + <lvc:CartesianChart.AxisY> + <lvc:Axis Title="{Binding PrintPerWeekSeries.ChartTitle}" MinValue="0" Foreground="#202020" > + <lvc:Axis.Separator> + <lvc:Separator Stroke="#B0B0B0" /> + </lvc:Axis.Separator> + </lvc:Axis> + </lvc:CartesianChart.AxisY> + </lvc:CartesianChart> + </DockPanel> + </Border> </UniformGrid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/app.config index 354aeba1d..b18dd5be9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/app.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,27 +28,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -74,6 +74,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config index 96b77fa8f..8d0c46fa1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,27 +28,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -74,6 +74,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml index 22fd8eaa8..9b9334355 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml @@ -32,7 +32,7 @@ <!--Content--> <Grid> <!--<Viewbox Stretch="Fill">--> - <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}" /> + <controls:WpfGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}" /> <!--</Viewbox>--> </Grid> <!--Content--> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml index ca2481de6..622ddfa8b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml @@ -32,9 +32,9 @@ <!--Content--> <Grid> <!--<Viewbox Stretch="Fill">--> - <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}"> + <controls:WpfGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}"> - </controls:RealTimeGraphControl> + </controls:WpfGraphControl> <!--</Viewbox>--> </Grid> <!--Content--> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 7e6f4e111..ff45bcbf9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -522,16 +522,12 @@ </None> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\..\SideChains\RealTimeGraphEx\RealTimeGraphEx.csproj"> - <Project>{b9ae25d6-be35-492f-9079-21a7f3e6f7cc}</Project> - <Name>RealTimeGraphEx</Name> - </ProjectReference> - <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX.WPF\RealTimeGraphX.WPF.csproj"> - <Project>{99d233c5-fee7-418e-9c25-d4584cb52e28}</Project> + <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX-master\RealTimeGraphX.WPF\RealTimeGraphX.WPF.csproj"> + <Project>{6b9774f7-960d-438e-ad81-c6b9be328d50}</Project> <Name>RealTimeGraphX.WPF</Name> </ProjectReference> - <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX\RealTimeGraphX.csproj"> - <Project>{6d55a3b8-46d3-493a-a143-aebd2b98d683}</Project> + <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX-master\RealTimeGraphX\RealTimeGraphX.csproj"> + <Project>{f13a489c-80ee-4cd0-bdd4-92d959215646}</Project> <Name>RealTimeGraphX</Name> </ProjectReference> <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> @@ -728,7 +724,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs index 28c75f79f..ca132095c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs @@ -1,8 +1,7 @@ using RealTimeGraphX; using RealTimeGraphX.DataPoints; using RealTimeGraphX.Renderers; -using RealTimeGraphX.WPF.DataSeries; -using RealTimeGraphX.WPF.Painters; +using RealTimeGraphX.WPF; using System; using System.Collections.Generic; using System.Linq; @@ -11,19 +10,11 @@ using System.Threading.Tasks; namespace Tango.MachineStudio.Technician { - public class TechGraphController : GraphControllerBase<WpfDataSeries, TimeSpanDataPoint, DoubleDataPoint> + public class TechGraphController : WpfGraphController<TimeSpanDataPoint, DoubleDataPoint> { public TechGraphController(int refreshRate = 50) { - var renderer = new GraphScrollingRenderer<WpfDataSeries, TimeSpanDataPoint, DoubleDataPoint>() - { - RefreshRate = TimeSpan.FromMilliseconds(refreshRate) - }; - - var painter = new WpfScrollingGraphPainter(); - - ConnectOutput(renderer); - renderer.ConnectOutput(painter); + RefreshRate = TimeSpan.FromMilliseconds(50); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index 377738d09..1412175a0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -1,4 +1,5 @@ using RealTimeGraphX.DataPoints; +using RealTimeGraphX.WPF; using System; using System.Collections.Generic; using System.Linq; @@ -213,7 +214,7 @@ namespace Tango.MachineStudio.Technician.TechItems { if (Editor != null) { - var controller = Editor.InnerGraph.Controller; + var controller = Editor.InnerGraph.Controller as WpfGraphController<TimeSpanDataPoint,DoubleDataPoint>; controller.Range.MaximumX = new TimeSpanDataPoint(TimeSpan.FromSeconds(_duration)); controller.Range.MinimumY = new DoubleDataPoint(_min); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index 808dadb68..8ccd5e718 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -1,4 +1,5 @@ using RealTimeGraphX.DataPoints; +using RealTimeGraphX.WPF; using System; using System.Collections.Generic; using System.Linq; @@ -217,7 +218,7 @@ namespace Tango.MachineStudio.Technician.TechItems { if (Editor != null) { - var controller = Editor.InnerGraph.Controller; + var controller = Editor.InnerGraph.Controller as WpfGraphController<TimeSpanDataPoint, DoubleDataPoint>; ; controller.Range.MaximumX = new TimeSpanDataPoint(TimeSpan.FromSeconds(_duration)); controller.Range.MinimumY = new DoubleDataPoint(_min); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 666a56704..72e43d7b0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -1,6 +1,5 @@ using Google.Protobuf.Collections; using Microsoft.Win32; -using RealTimeGraphEx.Controllers; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -36,9 +35,9 @@ using Tango.MachineStudio.Technician.Models; using Tango.Logging; using Microsoft.WindowsAPICodePack.Dialogs; using RealTimeGraphX; -using RealTimeGraphX.WPF.DataSeries; using RealTimeGraphX.DataPoints; using Tango.MachineStudio.Technician.Views; +using RealTimeGraphX.WPF; namespace Tango.MachineStudio.Technician.ViewModels { @@ -1024,7 +1023,7 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = element as SingleGraphElementEditor; TechGraphController controller = new TechGraphController(); - controller.AddDataSeries(new WpfDataSeries() + controller.DataSeriesCollection.Add(new WpfGraphDataSeries() { Stroke = Colors.DodgerBlue, }); @@ -1043,7 +1042,7 @@ namespace Tango.MachineStudio.Technician.ViewModels for (int i = 0; i < graphItem.TechMonitor.ChannelCount; i++) { - controller.AddDataSeries(new WpfDataSeries() + controller.DataSeriesCollection.Add(new WpfGraphDataSeries() { Stroke = ColorHelper.GetRandomColor(), Name = graphItem.TechMonitor.Name.First() + (i + 1).ToString(), @@ -1437,7 +1436,7 @@ namespace Tango.MachineStudio.Technician.ViewModels controller.Range.MaximumY = item.TechMonitor.Max; controller.Range.MaximumX = TimeSpan.FromSeconds(10); - controller.AddDataSeries(new WpfDataSeries() + controller.DataSeriesCollection.Add(new WpfGraphDataSeries() { Stroke = Colors.DodgerBlue, }); @@ -1498,7 +1497,7 @@ namespace Tango.MachineStudio.Technician.ViewModels for (int i = 0; i < item.TechMonitor.ChannelCount; i++) { - controller.AddDataSeries(new WpfDataSeries() + controller.DataSeriesCollection.Add(new WpfGraphDataSeries() { Stroke = ColorHelper.GetRandomColor(), Name = item.TechMonitor.Name.First() + (i + 1).ToString(), @@ -1749,13 +1748,13 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <exception cref="NotImplementedException"></exception> private void InitJobRunnerItem(JobRunnerItem item) { - item.StartJob += () => + item.StartJob += async () => { try { CheckMachineOperator(); - var handler = MachineOperator.Print(item.Job, item.ProcessParameters); + var handler = await MachineOperator.Print(item.Job, item.ProcessParameters); item.JobHandler = handler; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 92e2b292a..8820fcd4d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -26,9 +26,9 @@ <localConverters:SecondsToTimeSpanConverter x:Key="SecondsToTimeSpanConverter" /> <DataTemplate x:Key="TabTemplate"> - <Grid> - <Grid.Style> - <Style TargetType="Grid"> + <Border IsVisibleChanged="Border_IsVisibleChanged"> + <Border.Style> + <Style TargetType="Border"> <Setter Property="Visibility" Value="Visible"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding IsSelected}" Value="False"> @@ -36,12 +36,13 @@ </DataTrigger> </Style.Triggers> </Style> - </Grid.Style> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="Auto"/> - </Grid.ColumnDefinitions> - <editors:ElementsEditor + </Border.Style> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <editors:ElementsEditor x:Name="editor" Elements="{Binding Elements}" Loaded="Editor_Loaded" @@ -61,63 +62,64 @@ BorderBrush="#1EA9FF" BorderThickness="1"> - <editors:ElementsEditor.Style> - <Style TargetType="editors:ElementsEditor"> - <Setter Property="IsEditable" Value="True"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=listMode,Path=SelectedIndex}" Value="1"> - <Setter Property="IsEditable" Value="False"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </editors:ElementsEditor.Style> + <editors:ElementsEditor.Style> + <Style TargetType="editors:ElementsEditor"> + <Setter Property="IsEditable" Value="True"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=listMode,Path=SelectedIndex}" Value="1"> + <Setter Property="IsEditable" Value="False"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </editors:ElementsEditor.Style> - <editors:ElementsEditor.ContextMenu> - <ContextMenu DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}"> - <MenuItem Header="Cut (Ctrl+X)" Command="{Binding CutCommand}" MinWidth="210"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Cut" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <MenuItem Header="Copy (Ctrl+C)" Command="{Binding CopyCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Copy" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <MenuItem Header="Paste (Ctrl+V)" Command="{Binding PasteCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Paste" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <Separator/> - <MenuItem Header="Undo (Ctrl+Z)" Command="{Binding UndoCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Undo" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <MenuItem Header="Redo (Ctrl+Y)" Command="{Binding RedoCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="RotateRight" Width="16"></fa:ImageAwesome> - </MenuItem.Icon> - </MenuItem> - <Separator/> - <MenuItem Header="Delete (DELETE)" Command="{Binding DeleteCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Recycle" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <Separator/> - <MenuItem Header="Select All (Ctrl+A)" Command="{Binding SelectAllCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Th" Width="16" /> - </MenuItem.Icon> - </MenuItem> - </ContextMenu> - </editors:ElementsEditor.ContextMenu> - </editors:ElementsEditor> + <editors:ElementsEditor.ContextMenu> + <ContextMenu DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}"> + <MenuItem Header="Cut (Ctrl+X)" Command="{Binding CutCommand}" MinWidth="210"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Cut" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Copy (Ctrl+C)" Command="{Binding CopyCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Copy" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Paste (Ctrl+V)" Command="{Binding PasteCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Paste" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Undo (Ctrl+Z)" Command="{Binding UndoCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Undo" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Redo (Ctrl+Y)" Command="{Binding RedoCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="RotateRight" Width="16"></fa:ImageAwesome> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Delete (DELETE)" Command="{Binding DeleteCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Recycle" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Select All (Ctrl+A)" Command="{Binding SelectAllCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Th" Width="16" /> + </MenuItem.Icon> + </MenuItem> + </ContextMenu> + </editors:ElementsEditor.ContextMenu> + </editors:ElementsEditor> - <Slider Grid.Column="1" Orientation="Vertical" Margin="5" Maximum="3" Minimum="0.2" Value="{Binding ElementName=editor,Path=ScaleFactor}"></Slider> - </Grid> + <Slider Grid.Column="1" Orientation="Vertical" Margin="5" Maximum="3" Minimum="0.2" Value="{Binding ElementName=editor,Path=ScaleFactor}"></Slider> + </Grid> + </Border> </DataTemplate> </UserControl.Resources> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs index 694debd26..e4ebe2424 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs @@ -23,11 +23,14 @@ namespace Tango.MachineStudio.Technician.Views public partial class MachineTechView : UserControl { private MachineTechViewVM _vm; + private Dictionary<Border, UIElement> _tabs_content; public MachineTechView() { InitializeComponent(); + _tabs_content = new Dictionary<Border, UIElement>(); + this.Loaded += (x, y) => { _vm = DataContext as MachineTechViewVM; @@ -67,5 +70,22 @@ namespace Tango.MachineStudio.Technician.Views (editor.UndoRedoStatesProvider as ElementsEditorUndoRedoStatesProvider).StateExecuted += MachineTechView_StateExecuted; } + + private void Border_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) + { + Border border = sender as Border; + if (border.Visibility != Visibility.Visible) + { + _tabs_content[border] = border.Child; + border.Child = null; + } + else + { + if (_tabs_content.ContainsKey(border)) + { + border.Child = _tabs_content[border]; + } + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config index 96b77fa8f..8d0c46fa1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,27 +28,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -74,6 +74,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/app.config index 354aeba1d..b18dd5be9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/app.config @@ -20,7 +20,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -28,27 +28,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -74,6 +74,18 @@ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> |
