check point

This commit is contained in:
meelstorm
2025-07-14 12:03:59 +02:00
commit d3cb790bd9
431 changed files with 44078 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
namespace Inspectron.HawkEye.View
{
partial class ImagePreview
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
pictureBox1 = new PictureBox();
materialRaisedButton1 = new MaterialSkin.Controls.MaterialRaisedButton();
btnLearnThis = new MaterialSkin.Controls.MaterialRaisedButton();
btnNext = new MaterialSkin.Controls.MaterialRaisedButton();
btnPrev = new MaterialSkin.Controls.MaterialRaisedButton();
lblErrName = new Label();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
SuspendLayout();
//
// pictureBox1
//
pictureBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
pictureBox1.Location = new Point(16, 168);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(1540, 488);
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
pictureBox1.TabIndex = 0;
pictureBox1.TabStop = false;
//
// materialRaisedButton1
//
materialRaisedButton1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
materialRaisedButton1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
materialRaisedButton1.Cursor = Cursors.Hand;
materialRaisedButton1.Depth = 0;
materialRaisedButton1.DrawBorder = false;
materialRaisedButton1.Font = new Font("Verdana", 9F);
materialRaisedButton1.Icon = null;
materialRaisedButton1.Location = new Point(1384, 56);
materialRaisedButton1.MouseState = MaterialSkin.MouseState.HOVER;
materialRaisedButton1.Name = "materialRaisedButton1";
materialRaisedButton1.Primary = true;
materialRaisedButton1.Size = new Size(168, 64);
materialRaisedButton1.TabIndex = 2;
materialRaisedButton1.Text = "Close";
materialRaisedButton1.UseVisualStyleBackColor = true;
materialRaisedButton1.Click += materialRaisedButton1_Click;
//
// btnLearnThis
//
btnLearnThis.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnLearnThis.AutoSizeMode = AutoSizeMode.GrowAndShrink;
btnLearnThis.Cursor = Cursors.Hand;
btnLearnThis.Depth = 0;
btnLearnThis.DrawBorder = true;
btnLearnThis.Font = new Font("Verdana", 9F);
btnLearnThis.Icon = null;
btnLearnThis.Location = new Point(1032, 56);
btnLearnThis.MouseState = MaterialSkin.MouseState.HOVER;
btnLearnThis.Name = "btnLearnThis";
btnLearnThis.Primary = false;
btnLearnThis.Size = new Size(168, 64);
btnLearnThis.TabIndex = 3;
btnLearnThis.Text = "Learn this";
btnLearnThis.UseVisualStyleBackColor = true;
btnLearnThis.Click += btnLearnThis_Click;
//
// btnNext
//
btnNext.AutoSizeMode = AutoSizeMode.GrowAndShrink;
btnNext.Cursor = Cursors.Hand;
btnNext.Depth = 0;
btnNext.DrawBorder = true;
btnNext.Font = new Font("Verdana", 9F);
btnNext.Icon = null;
btnNext.Location = new Point(16, 56);
btnNext.MouseState = MaterialSkin.MouseState.HOVER;
btnNext.Name = "btnNext";
btnNext.Primary = false;
btnNext.Size = new Size(168, 64);
btnNext.TabIndex = 4;
btnNext.Text = "Backwards";
btnNext.UseVisualStyleBackColor = true;
btnNext.Visible = false;
btnNext.Click += btnNext_Click;
//
// btnPrev
//
btnPrev.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnPrev.AutoSizeMode = AutoSizeMode.GrowAndShrink;
btnPrev.Cursor = Cursors.Hand;
btnPrev.Depth = 0;
btnPrev.DrawBorder = true;
btnPrev.Font = new Font("Verdana", 9F);
btnPrev.Icon = null;
btnPrev.Location = new Point(1208, 56);
btnPrev.MouseState = MaterialSkin.MouseState.HOVER;
btnPrev.Name = "btnPrev";
btnPrev.Primary = false;
btnPrev.Size = new Size(168, 64);
btnPrev.TabIndex = 5;
btnPrev.Text = "Forward";
btnPrev.UseVisualStyleBackColor = true;
btnPrev.Visible = false;
btnPrev.Click += btnPrev_Click;
//
// lblErrName
//
lblErrName.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
lblErrName.BackColor = Color.White;
lblErrName.Location = new Point(16, 32);
lblErrName.Name = "lblErrName";
lblErrName.Size = new Size(836, 16);
lblErrName.TabIndex = 6;
lblErrName.Text = "label1";
lblErrName.TextAlign = ContentAlignment.MiddleLeft;
lblErrName.Visible = false;
//
// ImagePreview
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1568, 680);
Controls.Add(lblErrName);
Controls.Add(btnPrev);
Controls.Add(btnNext);
Controls.Add(btnLearnThis);
Controls.Add(materialRaisedButton1);
Controls.Add(pictureBox1);
MaximizeBox = false;
MinimizeBox = false;
Name = "ImagePreview";
WindowState = FormWindowState.Maximized;
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private MaterialSkin.Controls.MaterialRaisedButton materialRaisedButton1;
private MaterialSkin.Controls.MaterialRaisedButton btnLearnThis;
private MaterialSkin.Controls.MaterialRaisedButton btnNext;
private MaterialSkin.Controls.MaterialRaisedButton btnPrev;
private Label lblErrName;
}
}

View File

@@ -0,0 +1,74 @@
using System.ComponentModel;
using MaterialSkin.Controls;
using MaterialSkin.Core.Controls;
using OpenCvSharp.Extensions;
using VisionBuilder.UI.Common;
using VisionBuilder.UI.Common.ViewModel;
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
namespace Inspectron.HawkEye.View
{
public partial class ImagePreview : MaterialForm
{
private ErrorPreviewVM _previewVm;
public void SetViewModel(ErrorPreviewVM errorPreviewVm)
{
_previewVm = errorPreviewVm;
_previewVm.PropertyChanged += PreviewVmOnPropertyChanged;
btnLearnThis.Visible = _previewVm.LearnButtonVisible;
btnPrev.Visible = _previewVm.IsPreviousImageEnabled;
btnNext.Visible = _previewVm.IsNextImageEnabled;
pictureBox1.Image = _previewVm.ImageAnalysis?.ToBitmap();
}
private void PreviewVmOnPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case nameof(ErrorPreviewVM.ImageAnalysis):
pictureBox1.Image = _previewVm.ImageAnalysis?.ToBitmap();
break;
case nameof(ErrorPreviewVM.LearnButtonVisible):
btnLearnThis.Visible = _previewVm.LearnButtonVisible;
break;
case nameof(ErrorPreviewVM.IsPreviousImageEnabled):
btnPrev.Visible = _previewVm.IsPreviousImageEnabled;
break;
case nameof(ErrorPreviewVM.IsNextImageEnabled):
btnNext.Visible = _previewVm.IsNextImageEnabled;
break;
}
}
public ImagePreview()
{
InitializeComponent();
}
private void materialRaisedButton1_Click(object sender, EventArgs e)
{
Close();
}
private void btnLearnThis_Click(object sender, EventArgs e)
{
_previewVm.Learn();
Close();
}
private void btnPrev_Click(object sender, EventArgs e)
{
_previewVm.PreviousImage();
}
private void btnNext_Click(object sender, EventArgs e)
{
_previewVm.NextImage();
}
}
}

View File

@@ -0,0 +1,120 @@
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" 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">
<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" 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">
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,85 @@
namespace VisionBuilder.UI.Windows.Dialogs
{
partial class RecipeSelectionDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
listView1 = new ListView();
btnCancel = new MaterialSkin.Controls.MaterialRaisedButton();
SuspendLayout();
//
// listView1
//
listView1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
listView1.BorderStyle = BorderStyle.None;
listView1.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
listView1.Location = new Point(8, 32);
listView1.MultiSelect = false;
listView1.Name = "listView1";
listView1.Size = new Size(944, 575);
listView1.TabIndex = 4;
listView1.UseCompatibleStateImageBehavior = false;
listView1.MouseClick += listView1_MouseClick;
//
// btnCancel
//
btnCancel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
btnCancel.Depth = 0;
btnCancel.DrawBorder = true;
btnCancel.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold, GraphicsUnit.Point, 204);
btnCancel.Icon = null;
btnCancel.Location = new Point(792, 624);
btnCancel.MouseState = MaterialSkin.MouseState.HOVER;
btnCancel.Name = "btnCancel";
btnCancel.Primary = false;
btnCancel.Size = new Size(160, 48);
btnCancel.TabIndex = 5;
btnCancel.Text = "cancel";
btnCancel.UseVisualStyleBackColor = true;
btnCancel.Click += btnCancel_Click;
//
// RecipeSelectionDialog
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(962, 688);
Controls.Add(btnCancel);
Controls.Add(listView1);
MaximizeBox = false;
MinimizeBox = false;
Name = "RecipeSelectionDialog";
StartPosition = FormStartPosition.CenterScreen;
Text = "RecipeSelectionDialog";
ResumeLayout(false);
}
#endregion
private ListView listView1;
private MaterialSkin.Controls.MaterialRaisedButton btnCancel;
}
}

View File

@@ -0,0 +1,77 @@
using MaterialSkin.Controls;
using OpenCvSharp.XImgProc;
using System.Text.RegularExpressions;
using OpenCvSharp.Extensions;
using VisionBuilder.UI.Common.ViewModel;
using VisionBuilder.UI.Common.ViewModel.Classes;
namespace VisionBuilder.UI.Windows.Dialogs
{
public partial class RecipeSelectionDialog : MaterialForm
{
private readonly RecipeSelectionVM _recipeSelectionVm;
public RecipeSelectionDialog(RecipeSelectionVM recipeSelectionVm)
{
_recipeSelectionVm = recipeSelectionVm;
InitializeComponent();
ReloadRecipes();
}
public void ReloadRecipes()
{
var recipes = _recipeSelectionVm.Recipes.ToList();
listView1.Items.Clear();
recipes = recipes.OrderBy(x => x.RecipeName).ToList();
listView1.LargeImageList = new ImageList() { ColorDepth = ColorDepth.Depth24Bit };
listView1.LargeImageList.ImageSize = new Size(128, 128);
var plug = new Bitmap(128, 128);
using (Graphics g = Graphics.FromImage(plug))
{
g.Clear(Color.Gray);
}
listView1.LargeImageList.Images.Add("plug", plug);
recipes.ForEach(x =>
{
if (x.Image != null)
{
var image = x.Image.Resize(new OpenCvSharp.Size(128, 128)).ToBitmap();
listView1.LargeImageList.Images.Add(x.RecipeName, image);
listView1.Items.Add(x.RecipeName, x.RecipeName, x.RecipeName).Tag = x;
}
else
{
listView1.Items.Add(x.RecipeName, x.RecipeName, "plug").Tag=x;
}
});
}
private void listView1_MouseClick(object sender, MouseEventArgs e)
{
if (listView1.SelectedIndices.Count > 0)
{
_recipeSelectionVm.SelectedRecipe = (RecipeData)listView1.SelectedItems[0].Tag!;
}
DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
}

View File

@@ -0,0 +1,120 @@
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" 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">
<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" 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">
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>