check point
This commit is contained in:
8
VisionBuilder.UI.Windows.Test/AppSettings.cs
Normal file
8
VisionBuilder.UI.Windows.Test/AppSettings.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Inspectron.Settings;
|
||||
|
||||
namespace VisionBuilder.UI.Windows.Test;
|
||||
|
||||
public class AppSettings
|
||||
{
|
||||
|
||||
}
|
||||
135
VisionBuilder.UI.Windows.Test/Form1.Designer.cs
generated
Normal file
135
VisionBuilder.UI.Windows.Test/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,135 @@
|
||||
namespace VisionBuilder.UI.Windows.Test
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
btnMinimize = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
btnSettings = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
btnExit = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
materialDivider1 = new MaterialSkin.Controls.MaterialDivider();
|
||||
singleCameraControl1 = new VisionBuilder.UI.Windows.Components.SingleCameraControl();
|
||||
SuspendLayout();
|
||||
//
|
||||
// btnMinimize
|
||||
//
|
||||
btnMinimize.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
btnMinimize.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
btnMinimize.Depth = 0;
|
||||
btnMinimize.DrawBorder = true;
|
||||
btnMinimize.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
|
||||
btnMinimize.Icon = null;
|
||||
btnMinimize.Location = new Point(784, 984);
|
||||
btnMinimize.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnMinimize.Name = "btnMinimize";
|
||||
btnMinimize.Primary = false;
|
||||
btnMinimize.Size = new Size(224, 64);
|
||||
btnMinimize.TabIndex = 8;
|
||||
btnMinimize.Text = "Minimize";
|
||||
btnMinimize.UseVisualStyleBackColor = true;
|
||||
btnMinimize.Click += btnMinimize_Click;
|
||||
//
|
||||
// btnSettings
|
||||
//
|
||||
btnSettings.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
btnSettings.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
btnSettings.Depth = 0;
|
||||
btnSettings.DrawBorder = true;
|
||||
btnSettings.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
|
||||
btnSettings.Icon = null;
|
||||
btnSettings.Location = new Point(552, 984);
|
||||
btnSettings.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnSettings.Name = "btnSettings";
|
||||
btnSettings.Primary = false;
|
||||
btnSettings.Size = new Size(224, 64);
|
||||
btnSettings.TabIndex = 7;
|
||||
btnSettings.Text = "Settings";
|
||||
btnSettings.UseVisualStyleBackColor = true;
|
||||
btnSettings.Click += btnSettings_Click;
|
||||
//
|
||||
// btnExit
|
||||
//
|
||||
btnExit.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
btnExit.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
btnExit.Depth = 0;
|
||||
btnExit.DrawBorder = true;
|
||||
btnExit.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
|
||||
btnExit.Icon = null;
|
||||
btnExit.Location = new Point(1016, 984);
|
||||
btnExit.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnExit.Name = "btnExit";
|
||||
btnExit.Primary = false;
|
||||
btnExit.Size = new Size(224, 64);
|
||||
btnExit.TabIndex = 6;
|
||||
btnExit.Text = "Exit";
|
||||
btnExit.UseVisualStyleBackColor = true;
|
||||
btnExit.Click += btnExit_Click;
|
||||
//
|
||||
// materialDivider1
|
||||
//
|
||||
materialDivider1.BackColor = Color.FromArgb(55, 71, 79);
|
||||
materialDivider1.Depth = 0;
|
||||
materialDivider1.Location = new Point(8, 960);
|
||||
materialDivider1.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
materialDivider1.Name = "materialDivider1";
|
||||
materialDivider1.Size = new Size(1904, 1);
|
||||
materialDivider1.TabIndex = 9;
|
||||
materialDivider1.Text = "materialDivider1";
|
||||
//
|
||||
// singleCameraControl1
|
||||
//
|
||||
singleCameraControl1.BackColor = Color.White;
|
||||
singleCameraControl1.Location = new Point(8, 32);
|
||||
singleCameraControl1.Name = "singleCameraControl1";
|
||||
singleCameraControl1.Size = new Size(1904, 912);
|
||||
singleCameraControl1.TabIndex = 10;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1920, 1080);
|
||||
Controls.Add(singleCameraControl1);
|
||||
Controls.Add(materialDivider1);
|
||||
Controls.Add(btnMinimize);
|
||||
Controls.Add(btnSettings);
|
||||
Controls.Add(btnExit);
|
||||
Name = "Form1";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Form1";
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnMinimize;
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnSettings;
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnExit;
|
||||
private MaterialSkin.Controls.MaterialDivider materialDivider1;
|
||||
private Components.SingleCameraControl singleCameraControl1;
|
||||
}
|
||||
}
|
||||
33
VisionBuilder.UI.Windows.Test/Form1.cs
Normal file
33
VisionBuilder.UI.Windows.Test/Form1.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using MaterialSkin.Controls;
|
||||
using VisionBuilder.UI.Common.ViewModel;
|
||||
|
||||
namespace VisionBuilder.UI.Windows.Test
|
||||
{
|
||||
public partial class Form1 : MaterialForm
|
||||
{
|
||||
private readonly MainWindowVM _mainWindowVm;
|
||||
|
||||
public Form1(MainWindowVM mainWindowVm)
|
||||
{
|
||||
_mainWindowVm = mainWindowVm;
|
||||
MaterialSkin.MaterialSkinManager.ConfigureForInspectron();
|
||||
InitializeComponent();
|
||||
singleCameraControl1.SetViewModel(mainWindowVm.SingleCameraVms[0]);
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
private void btnMinimize_Click(object sender, EventArgs e)
|
||||
{
|
||||
WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
|
||||
private void btnSettings_Click(object sender, EventArgs e)
|
||||
{
|
||||
_mainWindowVm.SettingsCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
VisionBuilder.UI.Windows.Test/Form1.resx
Normal file
120
VisionBuilder.UI.Windows.Test/Form1.resx
Normal 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>
|
||||
93
VisionBuilder.UI.Windows.Test/Program.cs
Normal file
93
VisionBuilder.UI.Windows.Test/Program.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using VisionBuilder.UI.Common;
|
||||
using VisionBuilder.UI.Common.Commands;
|
||||
using VisionBuilder.UI.Common.ViewModel;
|
||||
using VisionBuilder.UI.Common.ViewModel.Classes;
|
||||
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
|
||||
using VisionBuilder.UI.Windows.Settings;
|
||||
using System.Threading;
|
||||
using Hawkeye.VisionBuilder.UI.Sources.Emulation;
|
||||
using Inspectron.Settings;
|
||||
using Inspectron.Settings.Windows.Configuration;
|
||||
using Lindt.Colorballs.Duo.Utils;
|
||||
using Ninject;
|
||||
using OpenCvSharp;
|
||||
using VisionBuilder.UI.Common.RecipeProcessing;
|
||||
using VisionBuilder.UI.Recipes.HawkeyeRecipe;
|
||||
|
||||
namespace VisionBuilder.UI.Windows.Test
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
|
||||
|
||||
StandardKernel kernelCamera1 = new StandardKernel();
|
||||
|
||||
|
||||
// SETTINGS //
|
||||
InspectronSettings settings = new InspectronSettings("..\\Config\\AppSettings.xml");
|
||||
kernelCamera1.Bind<InspectronSettings>().ToConstant(settings);
|
||||
kernelCamera1.Bind<UIConfiguration,ISettings>().ToConstant(new UIConfiguration());
|
||||
kernelCamera1.Bind<CameraSettings, ISettings>().ToConstant(new CameraSettings("Camera 1"));
|
||||
kernelCamera1.Bind<EmulationSettings, ISettings>().ToConstant(new EmulationSettings("Camera 1"));
|
||||
kernelCamera1.Bind<HawkeyeRecognitionSettings, ISettings>().ToConstant(new HawkeyeRecognitionSettings("Camera 1"));
|
||||
kernelCamera1.Bind<VisionBuilderRingbufferSettings, ISettings>().ToConstant(new VisionBuilderRingbufferSettings("Camera 1"));
|
||||
|
||||
kernelCamera1.RegisterSettings();
|
||||
settings.LoadSettings();
|
||||
|
||||
|
||||
// --- //
|
||||
|
||||
// SOURCES //
|
||||
var cameraSettings = kernelCamera1.Get<CameraSettings>();
|
||||
switch (cameraSettings.Camera1Source)
|
||||
{
|
||||
case CameraSettings.EImageSource.Emulation:
|
||||
kernelCamera1.Bind<IImageSource>().To<EmulationCameraImageSource>().InSingletonScope();
|
||||
break;
|
||||
case CameraSettings.EImageSource.Hawkeye:
|
||||
break;
|
||||
case CameraSettings.EImageSource.IDS:
|
||||
break;
|
||||
case CameraSettings.EImageSource.Basler:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
// --- //
|
||||
|
||||
// SERVICES //
|
||||
kernelCamera1.Bind<ISettingsService>().To<SettingsService>().InSingletonScope();
|
||||
kernelCamera1.Bind<IRecognitionControl>().To<HawkeyeRecognitionControl>().InSingletonScope();
|
||||
kernelCamera1.Bind<VisionBuilderRingbuffer>().ToSelf().InSingletonScope();
|
||||
kernelCamera1.Bind<ILoadingService>().To<LoadingService>().InSingletonScope();
|
||||
|
||||
kernelCamera1.Get<VisionBuilderRingbuffer>(); // initialize the ringbuffer
|
||||
|
||||
var mainWindowVm = new MainWindowVM(kernelCamera1.Get<ISettingsService>())
|
||||
{
|
||||
SingleCameraVms = new ObservableCollection<SingleCameraVM>()
|
||||
{
|
||||
new SingleCameraVM(kernelCamera1.Get<CameraSettings>(),kernelCamera1.Get<UIConfiguration>(),new RecipeSelectionDialogService(),kernelCamera1.Get<IRecognitionControl>(), new ImagePreviewService(), new NoLearning())
|
||||
}
|
||||
};
|
||||
|
||||
settings.LoadSettings();
|
||||
Application.Run(new Form1(mainWindowVm));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.6.0.20220608" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\framework\Inspectron.Settings.Windows\Inspectron.Settings.Windows.csproj" />
|
||||
<ProjectReference Include="..\framework\Inspectron.Settings\Inspectron.Settings.csproj" />
|
||||
<ProjectReference Include="..\framework\MaterialSkin.Core\MaterialSkin.Core.csproj" />
|
||||
<ProjectReference Include="..\Hawkeye.VisionBuilder.UI.Sources.Emulation\Hawkeye.VisionBuilder.UI.Sources.Emulation.csproj" />
|
||||
<ProjectReference Include="..\VisionBuilder.UI.Common\VisionBuilder.UI.Common.csproj" />
|
||||
<ProjectReference Include="..\VisionBuilder.UI.Recipes.HawkeyeRecipe\VisionBuilder.UI.Recipes.HawkeyeRecipe.csproj" />
|
||||
<ProjectReference Include="..\VisionBuilder.UI.Ringbuffer\VisionBuilder.UI.Ringbuffer.csproj" />
|
||||
<ProjectReference Include="..\VisionBuilder.UI.Windows\VisionBuilder.UI.Windows.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user