diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-10 14:50:37 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-10 14:50:37 +0300 |
| commit | f82ae06fbae6d69ea493906feb5ac13b57472b9d (patch) | |
| tree | 0b3c24f69ef85ea590cae7db4b97ca9db9caca3d /Software/Visual_Studio/MachineStudio/Modules | |
| parent | e5200c6ba6a1b13525cc1261992ad61b03f93951 (diff) | |
| download | Tango-f82ae06fbae6d69ea493906feb5ac13b57472b9d.tar.gz Tango-f82ae06fbae6d69ea493906feb5ac13b57472b9d.zip | |
MERGE
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
5 files changed, 578 insertions, 319 deletions
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 index 80918eb2e..c401c2134 100644 --- 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 @@ -9,6 +9,7 @@ //------------------------------------------------------------------------------ namespace Tango.MachineStudio.ColorCapture.Properties { + using System; /// <summary> @@ -18,7 +19,7 @@ namespace Tango.MachineStudio.ColorCapture.Properties { // 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -37,7 +38,7 @@ namespace Tango.MachineStudio.ColorCapture.Properties { [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { - if ((resourceMan == null)) { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.ColorCapture.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } @@ -58,5 +59,45 @@ namespace Tango.MachineStudio.ColorCapture.Properties { resourceCulture = value; } } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap bottomLeft { + get { + object obj = ResourceManager.GetObject("bottomLeft", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap bottomRight { + get { + object obj = ResourceManager.GetObject("bottomRight", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap topleft { + get { + object obj = ResourceManager.GetObject("topleft", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap topRight { + get { + object obj = ResourceManager.GetObject("topRight", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } 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 index af7dbebba..2803cb5b3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.resx +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : 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:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> @@ -68,9 +69,10 @@ <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> @@ -85,9 +87,10 @@ <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="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> @@ -109,9 +112,22 @@ <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> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.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> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="bottomLeft" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Images\bottomLeft.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="bottomRight" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Images\bottomRight.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="topleft" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Images\topleft.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="topRight" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Images\topRight.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root>
\ 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 index 9f21cadf2..a38db1b53 100644 --- 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 @@ -207,5 +207,8 @@ <Resource Include="Images\topleft.bmp" /> <Resource Include="Images\topRight.bmp" /> </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + </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/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs index 31eec0871..2f8d421cd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs @@ -117,7 +117,14 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels public ObservableCollection<BenchmarkItem> Benchmarks { get { return _benchmarks; } - set { _benchmarks = value; RaisePropertyChangedAuto(); } + set { _benchmarks = value; RaisePropertyChangedAuto(); OnBenchmarksChanged(); } + } + + private ObservableCollection<Color> emulatedColors; + public ObservableCollection<Color> EmulatedColors + { + get { return emulatedColors; } + set { emulatedColors = value; RaisePropertyChangedAuto(); } } private CaptureConfig _config; @@ -148,6 +155,33 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels set { _barcode = value; RaisePropertyChangedAuto(); } } + private bool _isEmulated; + public bool IsEmulated + { + get { return _isEmulated; } + set { _isEmulated = value; RaisePropertyChangedAuto(); } + } + + private int emulatedR; + public int EmulatedR + { + get { return emulatedR; } + set { emulatedR = value; RaisePropertyChangedAuto(); OnEmulatedColorChanged(); } + } + + private int emulatedG; + public int EmulatedG + { + get { return emulatedG; } + set { emulatedG = value; RaisePropertyChangedAuto(); OnEmulatedColorChanged(); } + } + + private int emulatedB; + public int EmulatedB + { + get { return emulatedB; } + set { emulatedB = value; RaisePropertyChangedAuto(); OnEmulatedColorChanged(); } + } public RelayCommand ImportBenchmarksCommand { get; set; } @@ -163,6 +197,10 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels public RelayCommand SelectTemplateFileCommand { get; set; } + public RelayCommand LiveCommand { get; set; } + + public RelayCommand EmulatedCommand { get; set; } + public MainViewVM() { Config = new CaptureConfig(); @@ -185,6 +223,8 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels SelectSamplesFolderCommand = new RelayCommand(SelectSamplesFolder); SelectBenchmarksFileCommand = new RelayCommand(SelectBenchmarkFile); SelectTemplateFileCommand = new RelayCommand(SelectTemplateFile); + LiveCommand = new RelayCommand(() => IsEmulated = false); + EmulatedCommand = new RelayCommand(() => IsEmulated = true); } public MainViewVM(IVideoCaptureProvider videoProvider, INotificationProvider notificationProvider) : this() @@ -403,13 +443,18 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels } } - private async void OnVideoFrameReceived(object sender, Video.DirectShow.EventArguments.FrameReceivedEventArgs args) + private void OnVideoFrameReceived(object sender, Video.DirectShow.EventArguments.FrameReceivedEventArgs args) { - if (_abort || IsPaused) return; + if (_abort || IsPaused || IsEmulated) return; + PerformDetection(args.BitmapSource); + } + + private async void PerformDetection(BitmapSource source) + { if (_cardDetector.CanDetect) { - var result = await _cardDetector.Detect(args.BitmapSource, new CardDetectionConfig() + var result = await _cardDetector.Detect(source, new CardDetectionConfig() { Benchmarks = Benchmarks.ToList().Select(x => x.ToDetectionBenchmark()).ToList(), Columns = Config.Columns, @@ -539,5 +584,79 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels return _deltaEComparison; } + + private void OnBenchmarksChanged() + { + EmulatedColors = new ObservableCollection<Color>(); + + if (Benchmarks != null) + { + foreach (var mark in Benchmarks) + { + EmulatedColors.Add(Color.FromRgb((byte)mark.Red, (byte)mark.Green, (byte)mark.Blue)); + } + + OnEmulatedColorChanged(); + } + } + + private void OnEmulatedColorChanged() + { + if (EmulatedColors != null && EmulatedColors.Count > Config.TargetIndex) + { + Color color = Color.FromRgb((byte)EmulatedR, (byte)EmulatedG, (byte)EmulatedB); + EmulatedColors[Config.TargetIndex] = color; + + if (IsEmulated) + { + DetectionOutput output = new DetectionOutput(); + output.ColorMatrix.AddRange(EmulatedColors.Select(x => new DetectionColor() + { + R = x.R, + G = x.G, + B = x.B, + })); + output.ProcessedColor = new DetectionColor() + { + R = EmulatedR, + G = EmulatedG, + B = EmulatedB, + }; + + var bitmap = ColorDetector.DetectionOutputToImage(new DetectionInput() + { + Columns = Config.Columns, + Rows = Config.Rows, + TargetIndex = Config.TargetIndex + + }, output, Config.SampleWidth, Config.SampleHeight, true, true, false); + + float rectWidth = (bitmap.Width / Config.Columns) - 4; + float rectHeight = (bitmap.Height / Config.Rows) - 4; + + using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap)) + { + g.DrawImage(Properties.Resources.topleft, new System.Drawing.RectangleF(0, 0, rectWidth, rectHeight)); + g.DrawImage(Properties.Resources.topRight, new System.Drawing.RectangleF(bitmap.Width - rectWidth, 0, rectWidth, rectHeight)); + + g.DrawImage(Properties.Resources.bottomLeft, new System.Drawing.RectangleF(0, bitmap.Height - rectHeight, rectWidth, rectHeight)); + g.DrawImage(Properties.Resources.bottomRight, new System.Drawing.RectangleF(bitmap.Width - rectWidth, bitmap.Height - rectHeight, rectWidth, rectHeight)); + } + + var bitmapContainer = new System.Drawing.Bitmap(640, 480); + using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmapContainer)) + { + g.Clear(System.Drawing.Color.White); + g.DrawImageUnscaled(bitmap, (bitmapContainer.Width / 2) - bitmap.Width / 2, (bitmapContainer.Height / 2) - bitmap.Height / 2); + } + + bitmap.Dispose(); + + PerformDetection(bitmapContainer.ToBitmapSource()); + + bitmapContainer.Dispose(); + } + } + } } } 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 index afdac7e18..616bdcfed 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml @@ -68,106 +68,150 @@ </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> + <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"> + <Border RenderOptions.BitmapScalingMode="Fant"> + <Grid> + <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> - <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> + <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"> + <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> - </DataTrigger> - </Style.Triggers> - </Style> - </Image.Style> - </Image> + <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> + <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> + <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> + + <Grid Visibility="{Binding IsEmulated,Converter={StaticResource BoolToVisConverter}}"> + <Grid.RowDefinitions> + <RowDefinition Height="60"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Grid Background="{StaticResource Background}"> + </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 + <Grid Background="{StaticResource LightBackground}" Grid.Row="1" Margin="1"> + <Border HorizontalAlignment="Center" VerticalAlignment="Center" BorderThickness="1" BorderBrush="{StaticResource Accent}" Padding="20" Background="{StaticResource Background}"> + <StackPanel Orientation="Horizontal"> + <Border BorderThickness="1" BorderBrush="{StaticResource Accent}"> + <controls:ColorMatrixControl Colors="{Binding EmulatedColors,Mode=OneWay}" Width="200" Height="210" Columns="10" Rows="11" Background="{StaticResource LightBackground}" /> + </Border> + + <UniformGrid Columns="3" Width="150" Height="200" Margin="40 0 0 0"> + <DockPanel> + <TextBlock Foreground="{StaticResource Red}" DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="0 0 0 5" Text="{Binding EmulatedR,FallbackValue=0}"></TextBlock> + <TextBlock Foreground="{StaticResource Red}" HorizontalAlignment="Center" DockPanel.Dock="Bottom" Margin="0 5 0 0">R</TextBlock> + <Slider Foreground="{StaticResource Red}" Orientation="Vertical" HorizontalAlignment="Center" Minimum="0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding EmulatedR,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel> + <TextBlock Foreground="{StaticResource Green}" DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="0 0 0 5" Text="{Binding EmulatedG,FallbackValue=0}"></TextBlock> + <TextBlock Foreground="{StaticResource Green}" HorizontalAlignment="Center" DockPanel.Dock="Bottom" Margin="0 5 0 0">G</TextBlock> + <Slider Foreground="{StaticResource Green}" Orientation="Vertical" HorizontalAlignment="Center" Minimum="0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding EmulatedG,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel> + <TextBlock Foreground="{StaticResource Blue}" DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="0 0 0 5" Text="{Binding EmulatedB,FallbackValue=0}"></TextBlock> + <TextBlock Foreground="{StaticResource Blue}" HorizontalAlignment="Center" DockPanel.Dock="Bottom" Margin="0 5 0 0">B</TextBlock> + <Slider Foreground="{StaticResource Blue}" Orientation="Vertical" HorizontalAlignment="Center" Minimum="0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding EmulatedB,Mode=TwoWay}"></Slider> + </DockPanel> + </UniformGrid> + + </StackPanel> + </Border> + </Grid> + </Grid> + </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" @@ -204,252 +248,288 @@ DialTextColor="Black" > - </gauge:CircularGaugeControl> - </Viewbox> - </DockPanel> - </Grid> + </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> + <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 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> + <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 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> + <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> - </DockPanel> - </Grid> + </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> + <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> - </DockPanel> - <TextBlock Margin="0 0 0 -20" VerticalAlignment="Bottom"> + <TextBlock Margin="0 0 0 -20" VerticalAlignment="Bottom"> <Run>Barcode:</Run> <Run Text="{Binding Barcode}" FontWeight="SemiBold" FontStyle="Italic"></Run> - </TextBlock> - </Grid> + </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 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">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> + <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 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> + <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> + <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"> + <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> + </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> + <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:WpfGraphGridLines Foreground="#3E3E3E" /> - <realtimeGraphX:WpfGraphSurface Controller="{Binding CaptureDeltaEController}"></realtimeGraphX:WpfGraphSurface> - </Grid> - </Border> - </Grid> - </Border> - </Grid> - </DockPanel> + <realtimeGraphX:WpfGraphSurface Controller="{Binding CaptureDeltaEController}"></realtimeGraphX:WpfGraphSurface> + </Grid> + </Border> + </Grid> + </Border> + </Grid> + </DockPanel> + </Grid> </Grid> </Grid> + + <UniformGrid VerticalAlignment="Top" HorizontalAlignment="Left" Width="200" Columns="2" Margin="300 -35 0 0"> + <Button Command="{Binding LiveCommand}" Height="35" Style="{StaticResource MaterialDesignFlatButton}" BorderThickness="0" Padding="5"> + <StackPanel Orientation="Horizontal"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="TextElement.Foreground" Value="{StaticResource Accent}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsEmulated}" Value="True"> + <Setter Property="TextElement.Foreground" Value="#808080"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <materialDesign:PackIcon Kind="Camera" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">Camera</TextBlock> + </StackPanel> + </Button> + <Button Command="{Binding EmulatedCommand}" Height="35" Style="{StaticResource MaterialDesignFlatButton}" BorderThickness="0" Padding="5"> + <StackPanel Orientation="Horizontal"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="TextElement.Foreground" Value="#808080"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsEmulated}" Value="True"> + <Setter Property="TextElement.Foreground" Value="{StaticResource Accent}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <materialDesign:PackIcon Kind="Image" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">Emulated</TextBlock> + </StackPanel> + </Button> + </UniformGrid> </Grid> </TabItem> <TabItem Header="BENCHMARKS" Foreground="{StaticResource Foreground}"> |
