2.0.8
This commit is contained in:
@@ -14,7 +14,7 @@ public class EmulationSettings : ISettings
|
||||
|
||||
public int CycleDelay { get; set; } = 1;
|
||||
public int PerImageDelay { get; set; } = 5000;
|
||||
public bool SingleRun { get; set; } = false;
|
||||
public bool SingleRun { get; set; } = true;
|
||||
public string EmulationPath { get; set; }
|
||||
|
||||
public void RegisterSettings(InspectronSettings settings)
|
||||
|
||||
@@ -32,7 +32,7 @@ public class IDSImageSourceSettings:ISettings
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var camera in cameraList)
|
||||
{
|
||||
sb.AppendLine($"Camera ID: {camera.CameraID}, Name: {camera.SerialNumber}");
|
||||
sb.Append($"{camera.CameraID}[{camera.SerialNumber}]");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
|
||||
@@ -46,9 +46,14 @@ namespace Hawkeye.VisionBuilder.Features.ImagePreview
|
||||
imagePreviewControl.GraphicsElements.Add(element);
|
||||
}
|
||||
|
||||
private void btnFit_Click(object sender, EventArgs e)
|
||||
public void Fit()
|
||||
{
|
||||
imagePreviewControl.FitToScreen();
|
||||
}
|
||||
|
||||
private void btnFit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Fit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,9 @@
|
||||
//
|
||||
// ckbExecuteWorkflow
|
||||
//
|
||||
ckbExecuteWorkflow.Checked = true;
|
||||
ckbExecuteWorkflow.CheckOnClick = true;
|
||||
ckbExecuteWorkflow.CheckState = CheckState.Checked;
|
||||
ckbExecuteWorkflow.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||
ckbExecuteWorkflow.Image = (Image)resources.GetObject("ckbExecuteWorkflow.Image");
|
||||
ckbExecuteWorkflow.ImageTransparentColor = Color.Magenta;
|
||||
|
||||
4
Hawkeye.VisionBuilder/MainWindow.Designer.cs
generated
4
Hawkeye.VisionBuilder/MainWindow.Designer.cs
generated
@@ -198,7 +198,7 @@
|
||||
// imageStatisticsToolStripMenuItem
|
||||
//
|
||||
imageStatisticsToolStripMenuItem.Name = "imageStatisticsToolStripMenuItem";
|
||||
imageStatisticsToolStripMenuItem.Size = new Size(180, 22);
|
||||
imageStatisticsToolStripMenuItem.Size = new Size(155, 22);
|
||||
imageStatisticsToolStripMenuItem.Text = "Image statistics";
|
||||
imageStatisticsToolStripMenuItem.Click += imageStatisticsToolStripMenuItem_Click;
|
||||
//
|
||||
@@ -213,7 +213,7 @@
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "MainWindow";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Hawkeye Vision Builder";
|
||||
Text = "Hawkeye Vision Builder Core";
|
||||
toolStrip1.ResumeLayout(false);
|
||||
toolStrip1.PerformLayout();
|
||||
menuStrip1.ResumeLayout(false);
|
||||
|
||||
@@ -152,7 +152,10 @@ namespace Hawkeye.VisionBuilder
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
WindowState= FormWindowState.Maximized;
|
||||
Application.DoEvents();
|
||||
OrganizeWindows(null, null);
|
||||
_previewPanel.Fit();
|
||||
}
|
||||
|
||||
private void OrganizeWindows(object sender, EventArgs e)
|
||||
|
||||
@@ -34,13 +34,15 @@ public static class Extensions
|
||||
return priorityAttribute?.Priority ?? 0;
|
||||
}
|
||||
|
||||
private static List<Type> _initializedModules = new List<Type>();
|
||||
static Dictionary<IKernel,List<Type>> _initializedModules = new Dictionary<IKernel, List<Type>>();
|
||||
|
||||
|
||||
public static void InitializeModules(this IKernel self)
|
||||
{
|
||||
if (!_initializedModules.ContainsKey(self)) _initializedModules[self] = new List<Type>();
|
||||
|
||||
var serviceTypes = self.GetAll(typeof(IVisionBuilderModule)).Select(x => (IVisionBuilderModule)x)
|
||||
.Where(x => !_initializedModules.Contains(x.GetType()))
|
||||
.Where(x => !_initializedModules[self].Contains(x.GetType()))
|
||||
.OrderByDescending(GetModulePriority)
|
||||
.ToList();
|
||||
foreach (var service in serviceTypes)
|
||||
@@ -58,7 +60,7 @@ public static class Extensions
|
||||
Log.Error($"Error initializing module {service.GetType().Name}: {e}", e);
|
||||
}
|
||||
|
||||
_initializedModules.Add(service.GetType());
|
||||
_initializedModules[self].Add(service.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ public class ErrorsVM:IEventHandler<ImageProcessedEvent>, IEventHandler<SessionS
|
||||
private readonly ILearningTool _learningTool;
|
||||
private readonly IPasswordInputService _passwordInputService;
|
||||
|
||||
private const string DATE_FORMAT = "dd.MM.yyyy";
|
||||
private const string TIME_FORMAT = "HH:mm:ss";
|
||||
|
||||
public ErrorsVM(UIConfiguration uiConfiguration, IImagePreviewService imagePreviewService, ILearningTool learningTool, IPasswordInputService passwordInputService)
|
||||
{
|
||||
_uiConfiguration = uiConfiguration;
|
||||
@@ -56,7 +59,7 @@ public class ErrorsVM:IEventHandler<ImageProcessedEvent>, IEventHandler<SessionS
|
||||
RecipeName = @event.RecipeName,
|
||||
ImageOriginal = @event.ImageOriginal,
|
||||
ImageAnalysis = @event.ImageAnalysis,
|
||||
Title =DateTime.Now.ToString("G")+ additionalInfo
|
||||
Title =DateTime.Now.ToString(DATE_FORMAT)+" "+ DateTime.Now.ToString(TIME_FORMAT) + additionalInfo
|
||||
};
|
||||
|
||||
if (Errors.Count >= _uiConfiguration.MaxErrorCount)
|
||||
|
||||
@@ -46,6 +46,14 @@ public partial class MainWindowVM:ObservableObject
|
||||
|
||||
public void OnProgramClosed()
|
||||
{
|
||||
foreach (var singleCameraVm in SingleCameraVms)
|
||||
{
|
||||
if (singleCameraVm.IsRunning)
|
||||
{
|
||||
singleCameraVm.StopCommand.Execute(null);
|
||||
|
||||
}
|
||||
}
|
||||
ProgramClosed?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,19 @@ namespace VisionBuilder.UI.Common;
|
||||
|
||||
public static class VisionBuilder
|
||||
{
|
||||
private static Mutex? _mutex;
|
||||
const string mutexName = "VisionBuilder.UI.SingleInstance";
|
||||
public static bool IsAlreadyRunning()
|
||||
{
|
||||
_mutex = new Mutex(true, mutexName, out bool createdNew);
|
||||
|
||||
if (!createdNew)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public static IKernel CreateMainKernel(InspectronSettings settings)
|
||||
{
|
||||
TypeDescriptor.AddAttributes(typeof(List<ErrorShortName>), new TypeConverterAttribute(typeof(ErrorShortNameConverter)));
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace VisionBuilder.UI.Statistics
|
||||
private const string EMPTY_TIME = "";
|
||||
private const string DATE_FORMAT = "dd.MM.yyyy";
|
||||
private const string TIME_FORMAT = "HH:mm:ss";
|
||||
private const string TIME_FORMAT_MS = "HH:mm:ss:fff";
|
||||
public bool DoNotDeleteTempFiles { get; set; } = false;
|
||||
|
||||
public VisionBuilderStatistics(VisionBuilderStatisticsSettings settings, IRecognitionControl recognitionControl, ILoadingService loadingService)
|
||||
@@ -78,7 +79,7 @@ namespace VisionBuilder.UI.Statistics
|
||||
_total++;
|
||||
if (obj.HasError)
|
||||
{
|
||||
RecordBadImage(obj.ErrorNames[0]);
|
||||
RecordBadImage(obj.ErrorNames.ToArray());
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"Recording statistics took {sw.ElapsedMilliseconds} ms");
|
||||
@@ -106,17 +107,19 @@ namespace VisionBuilder.UI.Statistics
|
||||
ConcurrentDictionary<string, int> _defects = new();
|
||||
private DateTime _endTime;
|
||||
|
||||
private void RecordBadImage(string defectName)
|
||||
private void RecordBadImage(string[] defectNames)
|
||||
{
|
||||
|
||||
_csvStatistics.WriteLine(
|
||||
|
||||
[_startTime.ToString(DATE_FORMAT), _startTime.ToString(TIME_FORMAT), EMPTY_DATE, EMPTY_TIME, DateTime.Now.ToString(TIME_FORMAT), _currentRecipe, defectName, Metadata]
|
||||
[_startTime.ToString(DATE_FORMAT), _startTime.ToString(TIME_FORMAT), EMPTY_DATE, EMPTY_TIME, DateTime.Now.ToString(DATE_FORMAT+" "+TIME_FORMAT_MS), _currentRecipe, defectNames[0], Metadata]
|
||||
|
||||
);
|
||||
|
||||
foreach (var defectName in defectNames)
|
||||
{
|
||||
_defects.AddOrUpdate(defectName, 1, (key, oldValue) => oldValue + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteMonthStatistics()
|
||||
{
|
||||
@@ -145,7 +148,7 @@ namespace VisionBuilder.UI.Statistics
|
||||
[_settings.ErrorColumnName, "Amount"]
|
||||
);
|
||||
|
||||
foreach (var defect in _defects)
|
||||
foreach (var defect in _defects.OrderBy(x=>x.Key))
|
||||
{
|
||||
monthStatistics.WriteLine(
|
||||
[defect.Key, defect.Value.ToString()]
|
||||
|
||||
201
VisionBuilder.UI.Windows.Duo/Form1.Designer.cs
generated
Normal file
201
VisionBuilder.UI.Windows.Duo/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,201 @@
|
||||
namespace VisionBuilder.UI.Windows.Duo
|
||||
{
|
||||
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();
|
||||
btnTestMode = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
flowLayoutPanel1 = new FlowLayoutPanel();
|
||||
lblVersion = new Label();
|
||||
singleCameraControl2 = new VisionBuilder.UI.Windows.Components.SingleCameraControl();
|
||||
flowLayoutPanel1.SuspendLayout();
|
||||
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(367, 3);
|
||||
btnMinimize.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnMinimize.Name = "btnMinimize";
|
||||
btnMinimize.Primary = false;
|
||||
btnMinimize.Size = new Size(176, 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(185, 3);
|
||||
btnSettings.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnSettings.Name = "btnSettings";
|
||||
btnSettings.Primary = false;
|
||||
btnSettings.Size = new Size(176, 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(549, 3);
|
||||
btnExit.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnExit.Name = "btnExit";
|
||||
btnExit.Primary = false;
|
||||
btnExit.Size = new Size(176, 64);
|
||||
btnExit.TabIndex = 6;
|
||||
btnExit.Text = "Exit";
|
||||
btnExit.UseVisualStyleBackColor = true;
|
||||
btnExit.Click += btnExit_Click;
|
||||
//
|
||||
// materialDivider1
|
||||
//
|
||||
materialDivider1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
materialDivider1.BackColor = Color.FromArgb(55, 71, 79);
|
||||
materialDivider1.Depth = 0;
|
||||
materialDivider1.Location = new Point(8, 984);
|
||||
materialDivider1.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
materialDivider1.Name = "materialDivider1";
|
||||
materialDivider1.Size = new Size(1904, 1);
|
||||
materialDivider1.TabIndex = 9;
|
||||
materialDivider1.Text = "materialDivider1";
|
||||
//
|
||||
// singleCameraControl1
|
||||
//
|
||||
singleCameraControl1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
singleCameraControl1.BackColor = Color.White;
|
||||
singleCameraControl1.Location = new Point(8, 32);
|
||||
singleCameraControl1.Name = "singleCameraControl1";
|
||||
singleCameraControl1.Size = new Size(1904, 464);
|
||||
singleCameraControl1.TabIndex = 10;
|
||||
//
|
||||
// btnTestMode
|
||||
//
|
||||
btnTestMode.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
btnTestMode.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
btnTestMode.Depth = 0;
|
||||
btnTestMode.DrawBorder = true;
|
||||
btnTestMode.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
|
||||
btnTestMode.Icon = null;
|
||||
btnTestMode.Location = new Point(3, 3);
|
||||
btnTestMode.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnTestMode.Name = "btnTestMode";
|
||||
btnTestMode.Primary = false;
|
||||
btnTestMode.Size = new Size(176, 64);
|
||||
btnTestMode.TabIndex = 11;
|
||||
btnTestMode.Text = "Test mode";
|
||||
btnTestMode.UseVisualStyleBackColor = true;
|
||||
btnTestMode.Click += btnTestMode_Click;
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
flowLayoutPanel1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
flowLayoutPanel1.AutoSize = true;
|
||||
flowLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
flowLayoutPanel1.BackColor = Color.Transparent;
|
||||
flowLayoutPanel1.Controls.Add(btnTestMode);
|
||||
flowLayoutPanel1.Controls.Add(btnSettings);
|
||||
flowLayoutPanel1.Controls.Add(btnMinimize);
|
||||
flowLayoutPanel1.Controls.Add(btnExit);
|
||||
flowLayoutPanel1.Location = new Point(664, 1002);
|
||||
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
flowLayoutPanel1.Size = new Size(728, 70);
|
||||
flowLayoutPanel1.TabIndex = 12;
|
||||
//
|
||||
// lblVersion
|
||||
//
|
||||
lblVersion.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
lblVersion.BackColor = Color.Transparent;
|
||||
lblVersion.Location = new Point(1768, 1056);
|
||||
lblVersion.Name = "lblVersion";
|
||||
lblVersion.Size = new Size(148, 23);
|
||||
lblVersion.TabIndex = 13;
|
||||
lblVersion.Text = "Version 0.0.0.0";
|
||||
lblVersion.TextAlign = ContentAlignment.TopRight;
|
||||
//
|
||||
// singleCameraControl2
|
||||
//
|
||||
singleCameraControl2.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
singleCameraControl2.BackColor = Color.White;
|
||||
singleCameraControl2.Location = new Point(8, 504);
|
||||
singleCameraControl2.Name = "singleCameraControl2";
|
||||
singleCameraControl2.Size = new Size(1904, 472);
|
||||
singleCameraControl2.TabIndex = 14;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1920, 1080);
|
||||
Controls.Add(singleCameraControl2);
|
||||
Controls.Add(lblVersion);
|
||||
Controls.Add(flowLayoutPanel1);
|
||||
Controls.Add(singleCameraControl1);
|
||||
Controls.Add(materialDivider1);
|
||||
Name = "Form1";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Form1";
|
||||
flowLayoutPanel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#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;
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnTestMode;
|
||||
private FlowLayoutPanel flowLayoutPanel1;
|
||||
private Label lblVersion;
|
||||
private Components.SingleCameraControl singleCameraControl2;
|
||||
}
|
||||
}
|
||||
109
VisionBuilder.UI.Windows.Duo/Form1.cs
Normal file
109
VisionBuilder.UI.Windows.Duo/Form1.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using MaterialSkin;
|
||||
using MaterialSkin.Controls;
|
||||
using VisionBuilder.UI.Common;
|
||||
using VisionBuilder.UI.Common.Services;
|
||||
using VisionBuilder.UI.Common.ViewModel;
|
||||
|
||||
namespace VisionBuilder.UI.Windows.Duo
|
||||
{
|
||||
public partial class Form1 : MaterialForm
|
||||
{
|
||||
private readonly MainWindowVM _mainWindowVm;
|
||||
private readonly IPasswordInputService _passwordInputService;
|
||||
private readonly UIConfiguration _uiConfiguration;
|
||||
private readonly WindowsUISettings _windowsUiSettings;
|
||||
|
||||
public Form1(MainWindowVM mainWindowVm, IPasswordInputService passwordInputService, UIConfiguration uiConfiguration, WindowsUISettings windowsUiSettings)
|
||||
{
|
||||
|
||||
_mainWindowVm = mainWindowVm;
|
||||
_passwordInputService = passwordInputService;
|
||||
_uiConfiguration = uiConfiguration;
|
||||
_windowsUiSettings = windowsUiSettings;
|
||||
MaterialSkin.MaterialSkinManager.ConfigureForInspectron();
|
||||
InitializeComponent();
|
||||
singleCameraControl1.SetViewModel(mainWindowVm.SingleCameraVms[0]);
|
||||
singleCameraControl2.SetViewModel(mainWindowVm.SingleCameraVms[1]);
|
||||
Load += Form1_Load;
|
||||
_mainWindowVm.PropertyChanged += _mainWindowVm_PropertyChanged;
|
||||
lblVersion.Text = $"v{Application.ProductVersion.Split('+')[0]}";
|
||||
if(!_uiConfiguration.ShowTestModeButton)
|
||||
flowLayoutPanel1.Controls.Remove(btnTestMode);
|
||||
|
||||
}
|
||||
|
||||
private void _mainWindowVm_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(_mainWindowVm.TestMode))
|
||||
{
|
||||
if (_mainWindowVm.TestMode)
|
||||
{
|
||||
MaterialSkinManager.Instance.ColorScheme = new ColorScheme(Primary.Green800, Primary.Green800,
|
||||
Primary.Green400, Accent.Green200, TextShade.WHITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
MaterialSkinManager.ConfigureForInspectron();
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
_mainWindowVm.OnProgramStarted();
|
||||
BringToFront();
|
||||
if (_windowsUiSettings.FullScreen)
|
||||
{
|
||||
WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
flowLayoutPanel1.Left = (ClientSize.Width - flowLayoutPanel1.Width) / 2;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
_mainWindowVm.OnProgramClosed();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
_mainWindowVm.OnProgramClosed();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
private void btnMinimize_Click(object sender, EventArgs e)
|
||||
{
|
||||
WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
|
||||
private void btnSettings_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_uiConfiguration.ProtectSettingsWithPassword)
|
||||
{
|
||||
var passwordOk = _passwordInputService.GetPassword() == _uiConfiguration.AdminPassword;
|
||||
if (!passwordOk)
|
||||
return;
|
||||
}
|
||||
_mainWindowVm.SettingsCommand.Execute(null);
|
||||
}
|
||||
|
||||
private void btnTestMode_Click(object sender, EventArgs e)
|
||||
{
|
||||
_mainWindowVm.ToggleTestModeCommand.Execute(null);
|
||||
}
|
||||
|
||||
public object GetHandle()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
VisionBuilder.UI.Windows.Duo/Form1.resx
Normal file
120
VisionBuilder.UI.Windows.Duo/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>
|
||||
BIN
VisionBuilder.UI.Windows.Duo/Inspectron icon-512.ico
Normal file
BIN
VisionBuilder.UI.Windows.Duo/Inspectron icon-512.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 103 KiB |
105
VisionBuilder.UI.Windows.Duo/Program.cs
Normal file
105
VisionBuilder.UI.Windows.Duo/Program.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using Inspectron.Settings;
|
||||
using Lindt.Colorballs.Duo.Utils;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.ChildKernel;
|
||||
using VisionBuilder.UI.Common;
|
||||
using VisionBuilder.UI.Common.Processing;
|
||||
using VisionBuilder.UI.Common.ViewModel;
|
||||
using VisionBuilder.UI.IOCommander;
|
||||
using VisionBuilder.UI.Recipes.HawkeyeRecipe;
|
||||
using VisionBuilder.UI.Ringbuffer;
|
||||
using VisionBuilder.UI.Statistics;
|
||||
using VisionBuilder.UI.Windows;
|
||||
using VisionBuilder.UI.Windows.Duo;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private const string CAMERA1 = "Camera 1";
|
||||
private const string CAMERA2 = "Camera 2";
|
||||
/// <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();
|
||||
// In your application startup code
|
||||
MaterialSkin.MaterialSkinManager.ConfigureForInspectron();
|
||||
|
||||
InspectronSettings settings = new InspectronSettings("..\\Data\\Config");
|
||||
|
||||
var mainKernel = VisionBuilder.UI.Common.VisionBuilder.CreateMainKernel(settings);
|
||||
|
||||
mainKernel.UsePlugins();
|
||||
|
||||
|
||||
mainKernel
|
||||
.UseConsole()
|
||||
.UseIOCommander([CAMERA1,CAMERA2])
|
||||
.UseIOCommanderWindowsDebug()
|
||||
.UseIOCommanderVirtualInput()
|
||||
.UseWindowsServices()
|
||||
.RegisterGlobalPlugins()
|
||||
;
|
||||
|
||||
mainKernel.Get<ILoadingService>().StartLoading("Camera initialization");
|
||||
|
||||
|
||||
// CAMERAS //
|
||||
ChildKernel kernelCamera1 = new ChildKernel(mainKernel);
|
||||
ChildKernel kernelCamera2 = new ChildKernel(mainKernel);
|
||||
|
||||
// MODULES //
|
||||
kernelCamera1
|
||||
.RegisterCamera(CAMERA1)
|
||||
.UseStatistics(CAMERA1)
|
||||
.UseRingbuffer(CAMERA1)
|
||||
.UseHawkeyeRecipes(CAMERA1)
|
||||
.UseCameraIOCommander(CAMERA1)
|
||||
.RegisterCameraPlugins(CAMERA1)
|
||||
;
|
||||
|
||||
kernelCamera2
|
||||
.RegisterCamera(CAMERA2)
|
||||
.UseStatistics(CAMERA2)
|
||||
.UseRingbuffer(CAMERA2)
|
||||
.UseHawkeyeRecipes(CAMERA2)
|
||||
.UseCameraIOCommander(CAMERA2)
|
||||
.RegisterCameraPlugins(CAMERA2)
|
||||
;
|
||||
|
||||
// LOAD SETTINGS //
|
||||
mainKernel.RegisterSettings();
|
||||
kernelCamera1.RegisterSettings();
|
||||
kernelCamera2.RegisterSettings();
|
||||
settings.LoadSettings();
|
||||
|
||||
// Create camera and bind it
|
||||
// Must be done after settings are loaded
|
||||
kernelCamera1.UseCamera();
|
||||
kernelCamera2.UseCamera();
|
||||
|
||||
// initialize modules
|
||||
mainKernel.InitializeModules();
|
||||
kernelCamera1.InitializeModules();
|
||||
kernelCamera2.InitializeModules();
|
||||
|
||||
mainKernel.Get<ILoadingService>().StopLoading("Camera initialization");
|
||||
|
||||
|
||||
|
||||
var mainWindowVm = mainKernel.Get<MainWindowVM>();
|
||||
mainWindowVm.SingleCameraVms = [
|
||||
kernelCamera1.Get<SingleCameraVM>(),
|
||||
kernelCamera2.Get<SingleCameraVM>()
|
||||
];
|
||||
|
||||
var form = mainKernel.Get<Form1>();
|
||||
|
||||
settings.LoadSettings();
|
||||
|
||||
Application.Run(form);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<ApplicationIcon>Inspectron icon-512.ico</ApplicationIcon>
|
||||
<Deterministic>false</Deterministic>
|
||||
<Version>2.0.8</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Inspectron icon-512.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Ninject.Extensions.ChildKernel" Version="3.3.0" />
|
||||
<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.Camera\VisionBuilder.UI.Camera.csproj" />
|
||||
<ProjectReference Include="..\VisionBuilder.UI.Common\VisionBuilder.UI.Common.csproj" />
|
||||
<ProjectReference Include="..\VisionBuilder.UI.Console\VisionBuilder.UI.Console.csproj" />
|
||||
<ProjectReference Include="..\VisionBuilder.UI.IOCommander.Windows\VisionBuilder.UI.IOCommander.Windows.csproj" />
|
||||
<ProjectReference Include="..\VisionBuilder.UI.IOCommander\VisionBuilder.UI.IOCommander.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.Statistics\VisionBuilder.UI.Statistics.csproj" />
|
||||
<ProjectReference Include="..\VisionBuilder.UI.Windows\VisionBuilder.UI.Windows.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Installer\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -8,7 +8,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationIcon>Inspectron icon-512.ico</ApplicationIcon>
|
||||
<Deterministic>false</Deterministic>
|
||||
<Version>1.0.7</Version>
|
||||
<Version>2.0.8</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
||||
@@ -129,11 +129,10 @@ namespace Inspectron.HawkEye.View
|
||||
lblErrName.BackColor = Color.White;
|
||||
lblErrName.Location = new Point(16, 32);
|
||||
lblErrName.Name = "lblErrName";
|
||||
lblErrName.Size = new Size(836, 16);
|
||||
lblErrName.Size = new Size(1536, 16);
|
||||
lblErrName.TabIndex = 6;
|
||||
lblErrName.Text = "label1";
|
||||
lblErrName.TextAlign = ContentAlignment.MiddleLeft;
|
||||
lblErrName.Visible = false;
|
||||
lblErrName.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// ImagePreview
|
||||
//
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Inspectron.HawkEye.View
|
||||
btnPrev.Enabled = _previewVm.IsPreviousImageEnabled;
|
||||
btnNext.Enabled = _previewVm.IsNextImageEnabled;
|
||||
pictureBox1.Image = _previewVm.ImageAnalysis?.ToBitmap();
|
||||
lblErrName.Text = _previewVm.ImageName;
|
||||
}
|
||||
|
||||
private void PreviewVmOnPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
|
||||
@@ -98,6 +98,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackstrasseBarcodeReader",
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CandyboxPlugin", "Plugins\CandyboxPlugin\CandyboxPlugin.csproj", "{31C47198-DEC2-4073-A0C2-220549502CD1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisionBuilder.UI.Windows.Duo", "VisionBuilder.UI.Windows.Duo\VisionBuilder.UI.Windows.Duo.csproj", "{AD3BC36E-8FC9-4A13-AD6B-606325AFF291}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -242,6 +244,10 @@ Global
|
||||
{31C47198-DEC2-4073-A0C2-220549502CD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{31C47198-DEC2-4073-A0C2-220549502CD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{31C47198-DEC2-4073-A0C2-220549502CD1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AD3BC36E-8FC9-4A13-AD6B-606325AFF291}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AD3BC36E-8FC9-4A13-AD6B-606325AFF291}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AD3BC36E-8FC9-4A13-AD6B-606325AFF291}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AD3BC36E-8FC9-4A13-AD6B-606325AFF291}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -277,6 +283,7 @@ Global
|
||||
{19E9B1A2-FBC6-2668-EDDF-1B3A6828184A} = {583A77DF-A293-4F3E-AB96-7310BC495822}
|
||||
{B20D7E75-1C19-632D-21D2-2663B0329C5E} = {583A77DF-A293-4F3E-AB96-7310BC495822}
|
||||
{31C47198-DEC2-4073-A0C2-220549502CD1} = {583A77DF-A293-4F3E-AB96-7310BC495822}
|
||||
{AD3BC36E-8FC9-4A13-AD6B-606325AFF291} = {F3414823-B70E-435E-B4EA-80ABF4371449}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3CE42AE5-D79F-4E97-A246-AA8FD228B677}
|
||||
|
||||
Reference in New Issue
Block a user