Add QRValidation project to repository

- Added QRValidation vision control system
- Includes CapCleaningControl UI components
- WebSocket-based barcode validation system
- Support for Crevis PLC integration
- Test projects for PLC emulator, motion, IO panel, and Modbus

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
atvstdla
2025-10-02 11:38:38 +09:00
parent 3eac3927f8
commit dc66158497
192 changed files with 27168 additions and 0 deletions

View File

@@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Project.Class
{
public class CAmkorSTDBarcode
{
public string Message { get; private set; }
public Boolean isValid = false;
public string SID { get; private set; }
public string VLOT { get; private set; }
public string RID { get; private set; }
public string MFGDate { get; set; }
public string SUPPLY { get; set; }
public int QTY { get; set; }
public string RAW { get; set; }
public Boolean DateError { get; set; }
public CAmkorSTDBarcode()
{
isValid = false;
}
public CAmkorSTDBarcode(string raw)
{
SetBarcode(raw);
}
public void SetBarcodeDemo()
{
SetBarcode("101410653;AG64B3W;SAMSUNG;20000;AG64B3W0031;19000101;");
}
/// <summary>
/// Returns barcode value with current property values.
/// To check the original barcode value, check the RAW property
/// </summary>
/// <returns></returns>
public string GetBarcode()
{
return string.Format("{0};{1};{2};{3};{4};{5};",
SID, VLOT, SUPPLY, QTY, RID, MFGDate);
}
public void SetBarcode(string raw)
{
isValid = false;
this.Message = string.Empty;
this.RAW = raw;
var buf = raw.Split(';');
if (buf.Length < 5)
{
isValid = false;
Message = "buffer len error : " + raw;
return;
}
decimal vSID = 0;
double vQty = 0;
if (decimal.TryParse(buf[0], out vSID) == false)
{
Message = "SID value is not a number. Amkor STD barcode consists of numbers";
return;
}
this.SID = vSID.ToString();
this.VLOT = buf[1];
this.SUPPLY = buf[2];
if (double.TryParse(buf[3], out vQty) == false) return;
this.QTY = (int)vQty;
this.RID = buf[4];
//DateTime vMFGDate;
MFGDate = buf[5].Trim();
DateError = false;
//buf[5] = buf[5].Replace("-", ""); //날짜표식제거
//if (this.SUPPLY.ToUpper() == "SAMSUNG" && buf[5].Length == 4) //삼성은 년도와 주차로 입력한다 210202
//{
// var y = "20" + buf[5].Substring(0, 2);
// MFGDate = new DateTime(int.Parse(y), 1, 1).ToString("yyyyMMdd"); //주차계산무시한다
// DateError = true;
//}
//else if (this.SUPPLY.ToUpper() == "WT" && buf[5].Length == 4) //삼성은 년도와 주차로 입력한다 210202
//{
// var y = "20" + buf[5].Substring(0, 2);
// MFGDate = new DateTime(int.Parse(y), 1, 1).ToString("yyyyMMdd"); //주차계산무시한다
// DateError = true;
//}
//else if (buf[5].Length == 8) //일반적인날짜데이터이며 YYYYMMDD 형태이다
//{
// buf[5] = buf[5].Substring(0, 4) + "-" + buf[5].Substring(4, 2) + "-" + buf[5].Substring(6, 2);
// if (DateTime.TryParse(buf[5], out vMFGDate) == false) return;
// MFGDate = vMFGDate.ToString("yyyyMMdd");
// DateError = false;
//}
////else if (buf[5].Equals("N/A")) //날짜값에 NA
////{
//// MFGDate = "N/A";
//// DateError = false;
////}
////else if (buf[5].Equals("NA")) //날짜값에 NA
////{
//// MFGDate = "NA";
//// DateError = false;
////}
//else
//{
// MFGDate = buf[5].Trim();
// Message = "Date value Length Error : " + buf[5];
// DateError = false;
// //return;
//}
isValid = true;
}
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Project
{
public class CInterLock
{
UInt64 offsetValue = 0x01;
public object Tag { get; set; }
public string errorMessage;
protected UInt64 _value;
public UInt64 Value { get { return _value; } set { _value = value; } }
public event EventHandler<ValueEventArgs> ValueChanged;
public class ValueEventArgs : EventArgs
{
private int _arridx;
private Boolean _oldvalue;
private Boolean _newvalue;
private string _reason;
public int ArrIDX { get { return _arridx; } }
public Boolean OldValue { get { return _oldvalue; } }
public Boolean NewValue { get { return _newvalue; } }
public string Reason { get { return _reason; } }
public Boolean NewOn { get; set; }
public Boolean NewOff { get; set; }
public ValueEventArgs(int arridx, Boolean oldvalue, Boolean newvalue, string reason_, Boolean newon_, Boolean newof_)
{
_arridx = arridx;
_oldvalue = oldvalue;
_newvalue = newvalue;
_reason = reason_;
this.NewOn = newon_;
this.NewOff = newon_;
}
}
public CInterLock(object tag = null)
{
errorMessage = string.Empty;
_value = 0;
this.Tag = tag;
}
public Boolean get(int idx)
{
if (idx >= 64)
throw new Exception("flag는 최대 64개를 지원 합니다");
var offset = (UInt64)(offsetValue << idx);
return (_value & offset) != 0;
}
public void set(int idx, Boolean value, string reason)
{
if (idx >= 64)
throw new Exception("flag는 최대 64개를 지원 합니다");
var oldvalue = get(idx);
var raw_old = _value;
if (value)
{
var offset = (UInt64)(offsetValue << idx);
_value = _value | offset;
}
else
{
var shiftvalue = (UInt64)(offsetValue << idx);
UInt64 offset = ~shiftvalue;
_value = _value & offset;
}
if (oldvalue != value)
{
Boolean NewOn = (raw_old == 0 && _value > 0);
Boolean NewOf = (raw_old != 0 && _value == 0);
if (ValueChanged != null)
ValueChanged(this, new ValueEventArgs(idx, oldvalue, value, reason, NewOn, NewOf));
}
else
{
//Pub.log.Add(" >> SKIP");
//if (string.IsNullOrEmpty(reason) == false)
//Pub.log.Add("#### FLAG변경(값이 같아서 처리 안함) : idx=" + idx.ToString() + ",값:" + value.ToString() + ",사유:" + reason);
}
}
public void Toggle(int idx, string reason = "")
{
var curValue = get(idx);
set(idx, !curValue, reason);
}
}
}

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Project
{
public enum eFlag
{
CHECKLICENSE=0,
CHECKCAMERAL,
CHECKCAMERAR,
CAMERAINIT,
}
public class Flag : CInterLock
{
public Boolean IsInit; //H/W설정이 안된경우에만 FALSE로 한다
public int PortCount;
public string[] Name;
public Flag()
{
this.Tag = "MAIN";
PortCount = 64;
IsInit = true;
errorMessage = string.Empty;
_value = 0;
Name = new string[PortCount];
for (int i = 0; i < Name.Length; i++)
{
Name[i] = string.Empty;
}
}
public bool get(eFlag flag)
{
return get((int)flag);
}
public void set(eFlag flag, bool value, string reason)
{
var idx = (int)flag;
set(idx, value, reason);
}
public void Toggle(eFlag flag)
{
Toggle((int)flag);
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Project.Class
{
public class WebSocket : WatsonWebsocket.WatsonWsServer
{
public eTarget Target { get; set; }
public int TargetIdx { get; set; }
public WebSocket(string host, int port) : base(host, port) { }
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Project
{
public static class Win32API
{
[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
private static extern int SetActiveWindow(int hwnd);
}
}

View File

@@ -0,0 +1,648 @@
namespace Project.Dialog
{
partial class fEmulator
{
/// <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()
{
this.components = new System.ComponentModel.Container();
arDev.AzinAxt.ColorListItem colorListItem5 = new arDev.AzinAxt.ColorListItem();
arDev.AzinAxt.ColorListItem colorListItem6 = new arDev.AzinAxt.ColorListItem();
arDev.AzinAxt.ColorListItem colorListItem7 = new arDev.AzinAxt.ColorListItem();
arDev.AzinAxt.ColorListItem colorListItem8 = new arDev.AzinAxt.ColorListItem();
this.panel1 = new System.Windows.Forms.Panel();
this.jogController5 = new arDev.AzinAxt.JogController();
this.jogController4 = new arDev.AzinAxt.JogController();
this.jogController3 = new arDev.AzinAxt.JogController();
this.jogController2 = new arDev.AzinAxt.JogController();
this.jogController1 = new arDev.AzinAxt.JogController();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.panel2 = new System.Windows.Forms.Panel();
this.tblDI = new arDev.AzinAxt.GridView();
this.lbTitle1 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.tblDO = new arDev.AzinAxt.GridView();
this.lbtitle2 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button1 = new System.Windows.Forms.Button();
this.ctlSensor1 = new UIControl.CtlSensor();
this.m4 = new UIControl.CtlMotor();
this.m3 = new UIControl.CtlMotor();
this.m2 = new UIControl.CtlMotor();
this.m1 = new UIControl.CtlMotor();
this.mcv = new UIControl.CtlMotor();
this.panel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.panel1.Controls.Add(this.jogController5);
this.panel1.Controls.Add(this.jogController4);
this.panel1.Controls.Add(this.jogController3);
this.panel1.Controls.Add(this.jogController2);
this.panel1.Controls.Add(this.jogController1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Location = new System.Drawing.Point(574, 0);
this.panel1.Name = "panel1";
this.panel1.Padding = new System.Windows.Forms.Padding(5);
this.panel1.Size = new System.Drawing.Size(226, 414);
this.panel1.TabIndex = 8;
//
// jogController5
//
this.jogController5.arAutoUpdate = false;
this.jogController5.arAxis = 4;
this.jogController5.arAxisName = "Z-R";
this.jogController5.arBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.jogController5.arBottomSensorCommand = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"POS"};
this.jogController5.arBottomSensorFont = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold);
this.jogController5.arBottomSensorHeight = 30;
this.jogController5.arBottomSensorListCount = new System.Drawing.Point(4, 2);
this.jogController5.arBottomSensorTitle = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"--"};
this.jogController5.arCellBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(90)))), ((int)(((byte)(90)))));
this.jogController5.ardAct = 200D;
this.jogController5.arDebugMode = false;
this.jogController5.arIsAlm = false;
this.jogController5.arIsHSet = true;
this.jogController5.arIsInit = false;
this.jogController5.arIsInp = false;
this.jogController5.arIsLimM = false;
this.jogController5.arIsLimP = false;
this.jogController5.arIsOrg = false;
this.jogController5.arIsSvON = true;
this.jogController5.arMaxLength = 400;
this.jogController5.arMinLength = -10;
this.jogController5.arShowJogButton = true;
this.jogController5.arShowPositionBar = true;
this.jogController5.arShowSensor = true;
this.jogController5.arShowTitleBar = true;
this.jogController5.arTitlebarHeight = ((ushort)(20));
this.jogController5.arUpdateInterval = ((ushort)(100));
this.jogController5.arUsage = true;
this.jogController5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.jogController5.Dock = System.Windows.Forms.DockStyle.Top;
this.jogController5.Font = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.jogController5.Location = new System.Drawing.Point(5, 293);
this.jogController5.Name = "jogController5";
this.jogController5.Size = new System.Drawing.Size(216, 72);
this.jogController5.TabIndex = 11;
this.jogController5.Text = "156";
//
// jogController4
//
this.jogController4.arAutoUpdate = false;
this.jogController4.arAxis = 3;
this.jogController4.arAxisName = "Z-F";
this.jogController4.arBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.jogController4.arBottomSensorCommand = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"POS"};
this.jogController4.arBottomSensorFont = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold);
this.jogController4.arBottomSensorHeight = 30;
this.jogController4.arBottomSensorListCount = new System.Drawing.Point(4, 2);
this.jogController4.arBottomSensorTitle = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"--"};
this.jogController4.arCellBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(90)))), ((int)(((byte)(90)))));
this.jogController4.ardAct = 200D;
this.jogController4.arDebugMode = false;
this.jogController4.arIsAlm = false;
this.jogController4.arIsHSet = true;
this.jogController4.arIsInit = false;
this.jogController4.arIsInp = false;
this.jogController4.arIsLimM = false;
this.jogController4.arIsLimP = false;
this.jogController4.arIsOrg = false;
this.jogController4.arIsSvON = true;
this.jogController4.arMaxLength = 400;
this.jogController4.arMinLength = -10;
this.jogController4.arShowJogButton = true;
this.jogController4.arShowPositionBar = true;
this.jogController4.arShowSensor = true;
this.jogController4.arShowTitleBar = true;
this.jogController4.arTitlebarHeight = ((ushort)(20));
this.jogController4.arUpdateInterval = ((ushort)(100));
this.jogController4.arUsage = true;
this.jogController4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.jogController4.Dock = System.Windows.Forms.DockStyle.Top;
this.jogController4.Font = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.jogController4.Location = new System.Drawing.Point(5, 221);
this.jogController4.Name = "jogController4";
this.jogController4.Size = new System.Drawing.Size(216, 72);
this.jogController4.TabIndex = 10;
this.jogController4.Text = "156";
//
// jogController3
//
this.jogController3.arAutoUpdate = false;
this.jogController3.arAxis = 2;
this.jogController3.arAxisName = "Y-P";
this.jogController3.arBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.jogController3.arBottomSensorCommand = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"POS"};
this.jogController3.arBottomSensorFont = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold);
this.jogController3.arBottomSensorHeight = 30;
this.jogController3.arBottomSensorListCount = new System.Drawing.Point(4, 2);
this.jogController3.arBottomSensorTitle = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"--"};
this.jogController3.arCellBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(90)))), ((int)(((byte)(90)))));
this.jogController3.ardAct = 200D;
this.jogController3.arDebugMode = false;
this.jogController3.arIsAlm = false;
this.jogController3.arIsHSet = true;
this.jogController3.arIsInit = false;
this.jogController3.arIsInp = false;
this.jogController3.arIsLimM = false;
this.jogController3.arIsLimP = false;
this.jogController3.arIsOrg = false;
this.jogController3.arIsSvON = true;
this.jogController3.arMaxLength = 400;
this.jogController3.arMinLength = -10;
this.jogController3.arShowJogButton = true;
this.jogController3.arShowPositionBar = true;
this.jogController3.arShowSensor = true;
this.jogController3.arShowTitleBar = true;
this.jogController3.arTitlebarHeight = ((ushort)(20));
this.jogController3.arUpdateInterval = ((ushort)(100));
this.jogController3.arUsage = true;
this.jogController3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.jogController3.Dock = System.Windows.Forms.DockStyle.Top;
this.jogController3.Font = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.jogController3.Location = new System.Drawing.Point(5, 149);
this.jogController3.Name = "jogController3";
this.jogController3.Size = new System.Drawing.Size(216, 72);
this.jogController3.TabIndex = 9;
this.jogController3.Text = "156";
//
// jogController2
//
this.jogController2.arAutoUpdate = false;
this.jogController2.arAxis = 1;
this.jogController2.arAxisName = "X-R";
this.jogController2.arBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.jogController2.arBottomSensorCommand = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"POS"};
this.jogController2.arBottomSensorFont = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold);
this.jogController2.arBottomSensorHeight = 30;
this.jogController2.arBottomSensorListCount = new System.Drawing.Point(4, 2);
this.jogController2.arBottomSensorTitle = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"--"};
this.jogController2.arCellBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(90)))), ((int)(((byte)(90)))));
this.jogController2.ardAct = 200D;
this.jogController2.arDebugMode = false;
this.jogController2.arIsAlm = false;
this.jogController2.arIsHSet = true;
this.jogController2.arIsInit = false;
this.jogController2.arIsInp = false;
this.jogController2.arIsLimM = false;
this.jogController2.arIsLimP = false;
this.jogController2.arIsOrg = false;
this.jogController2.arIsSvON = true;
this.jogController2.arMaxLength = 400;
this.jogController2.arMinLength = -10;
this.jogController2.arShowJogButton = true;
this.jogController2.arShowPositionBar = true;
this.jogController2.arShowSensor = true;
this.jogController2.arShowTitleBar = true;
this.jogController2.arTitlebarHeight = ((ushort)(20));
this.jogController2.arUpdateInterval = ((ushort)(100));
this.jogController2.arUsage = true;
this.jogController2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.jogController2.Dock = System.Windows.Forms.DockStyle.Top;
this.jogController2.Font = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.jogController2.Location = new System.Drawing.Point(5, 77);
this.jogController2.Name = "jogController2";
this.jogController2.Size = new System.Drawing.Size(216, 72);
this.jogController2.TabIndex = 8;
this.jogController2.Text = "156";
//
// jogController1
//
this.jogController1.arAutoUpdate = false;
this.jogController1.arAxis = 0;
this.jogController1.arAxisName = "X-F";
this.jogController1.arBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.jogController1.arBottomSensorCommand = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"POS"};
this.jogController1.arBottomSensorFont = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold);
this.jogController1.arBottomSensorHeight = 30;
this.jogController1.arBottomSensorListCount = new System.Drawing.Point(4, 2);
this.jogController1.arBottomSensorTitle = new string[] {
"INP",
"ORG",
"LIM+",
"HOME",
"ALM",
"SVON",
"LIM-",
"--"};
this.jogController1.arCellBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(90)))), ((int)(((byte)(90)))));
this.jogController1.ardAct = 200D;
this.jogController1.arDebugMode = false;
this.jogController1.arIsAlm = false;
this.jogController1.arIsHSet = true;
this.jogController1.arIsInit = false;
this.jogController1.arIsInp = false;
this.jogController1.arIsLimM = false;
this.jogController1.arIsLimP = false;
this.jogController1.arIsOrg = false;
this.jogController1.arIsSvON = true;
this.jogController1.arMaxLength = 400;
this.jogController1.arMinLength = -10;
this.jogController1.arShowJogButton = true;
this.jogController1.arShowPositionBar = true;
this.jogController1.arShowSensor = true;
this.jogController1.arShowTitleBar = true;
this.jogController1.arTitlebarHeight = ((ushort)(20));
this.jogController1.arUpdateInterval = ((ushort)(100));
this.jogController1.arUsage = true;
this.jogController1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.jogController1.Dock = System.Windows.Forms.DockStyle.Top;
this.jogController1.Font = new System.Drawing.Font("Consolas", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.jogController1.Location = new System.Drawing.Point(5, 5);
this.jogController1.Name = "jogController1";
this.jogController1.Size = new System.Drawing.Size(216, 72);
this.jogController1.TabIndex = 7;
this.jogController1.Text = "156";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(574, 230);
this.tableLayoutPanel1.TabIndex = 137;
//
// panel2
//
this.panel2.Controls.Add(this.tblDI);
this.panel2.Controls.Add(this.lbTitle1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Margin = new System.Windows.Forms.Padding(0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(574, 115);
this.panel2.TabIndex = 0;
//
// tblDI
//
this.tblDI.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.tblDI.BorderSize = 1;
colorListItem5.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
colorListItem5.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
colorListItem5.Remark = "";
colorListItem6.BackColor1 = System.Drawing.Color.Green;
colorListItem6.BackColor2 = System.Drawing.Color.Green;
colorListItem6.Remark = "";
this.tblDI.ColorList = new arDev.AzinAxt.ColorListItem[] {
colorListItem5,
colorListItem6};
this.tblDI.Cursor = System.Windows.Forms.Cursors.Arrow;
this.tblDI.Dock = System.Windows.Forms.DockStyle.Fill;
this.tblDI.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Bold);
this.tblDI.FontPin = new System.Drawing.Font("Consolas", 6.75F);
this.tblDI.ForeColor = System.Drawing.Color.WhiteSmoke;
this.tblDI.ForeColorPin = System.Drawing.Color.WhiteSmoke;
this.tblDI.Location = new System.Drawing.Point(0, 16);
this.tblDI.MatrixSize = new System.Drawing.Point(5, 4);
this.tblDI.MenuBorderSize = 1;
this.tblDI.MenuGap = 5;
this.tblDI.MinimumSize = new System.Drawing.Size(100, 50);
this.tblDI.Name = "tblDI";
this.tblDI.Names = null;
this.tblDI.ShadowColor = System.Drawing.Color.Black;
this.tblDI.showDebugInfo = false;
this.tblDI.ShowIndexString = true;
this.tblDI.Size = new System.Drawing.Size(574, 99);
this.tblDI.TabIndex = 3;
this.tblDI.Tags = null;
this.tblDI.Text = "gridView2";
this.tblDI.TextAttachToImage = true;
this.tblDI.Titles = null;
this.tblDI.Values = null;
//
// lbTitle1
//
this.lbTitle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.lbTitle1.Cursor = System.Windows.Forms.Cursors.Arrow;
this.lbTitle1.Dock = System.Windows.Forms.DockStyle.Top;
this.lbTitle1.Font = new System.Drawing.Font("Consolas", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbTitle1.ForeColor = System.Drawing.Color.White;
this.lbTitle1.Location = new System.Drawing.Point(0, 0);
this.lbTitle1.Name = "lbTitle1";
this.lbTitle1.Size = new System.Drawing.Size(574, 16);
this.lbTitle1.TabIndex = 0;
this.lbTitle1.Text = "INPUT";
this.lbTitle1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel3
//
this.panel3.Controls.Add(this.tblDO);
this.panel3.Controls.Add(this.lbtitle2);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 115);
this.panel3.Margin = new System.Windows.Forms.Padding(0);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(574, 115);
this.panel3.TabIndex = 0;
//
// tblDO
//
this.tblDO.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.tblDO.BorderSize = 1;
colorListItem7.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
colorListItem7.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
colorListItem7.Remark = "";
colorListItem8.BackColor1 = System.Drawing.Color.Tomato;
colorListItem8.BackColor2 = System.Drawing.Color.Tomato;
colorListItem8.Remark = "";
this.tblDO.ColorList = new arDev.AzinAxt.ColorListItem[] {
colorListItem7,
colorListItem8};
this.tblDO.Cursor = System.Windows.Forms.Cursors.Arrow;
this.tblDO.Dock = System.Windows.Forms.DockStyle.Fill;
this.tblDO.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tblDO.FontPin = new System.Drawing.Font("Consolas", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tblDO.ForeColor = System.Drawing.Color.WhiteSmoke;
this.tblDO.ForeColorPin = System.Drawing.Color.WhiteSmoke;
this.tblDO.Location = new System.Drawing.Point(0, 16);
this.tblDO.MatrixSize = new System.Drawing.Point(5, 4);
this.tblDO.MenuBorderSize = 1;
this.tblDO.MenuGap = 5;
this.tblDO.MinimumSize = new System.Drawing.Size(100, 50);
this.tblDO.Name = "tblDO";
this.tblDO.Names = null;
this.tblDO.ShadowColor = System.Drawing.Color.Black;
this.tblDO.showDebugInfo = false;
this.tblDO.ShowIndexString = true;
this.tblDO.Size = new System.Drawing.Size(574, 99);
this.tblDO.TabIndex = 3;
this.tblDO.Tags = null;
this.tblDO.Text = "gridView3";
this.tblDO.TextAttachToImage = true;
this.tblDO.Titles = null;
this.tblDO.Values = null;
//
// lbtitle2
//
this.lbtitle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.lbtitle2.Cursor = System.Windows.Forms.Cursors.Arrow;
this.lbtitle2.Dock = System.Windows.Forms.DockStyle.Top;
this.lbtitle2.Font = new System.Drawing.Font("Consolas", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbtitle2.ForeColor = System.Drawing.Color.White;
this.lbtitle2.Location = new System.Drawing.Point(0, 0);
this.lbtitle2.Name = "lbtitle2";
this.lbtitle2.Size = new System.Drawing.Size(574, 16);
this.lbtitle2.TabIndex = 1;
this.lbtitle2.Text = "OUTPUT";
this.lbtitle2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// button1
//
this.button1.Location = new System.Drawing.Point(11, 239);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(89, 28);
this.button1.TabIndex = 138;
this.button1.Text = "init IO/MOT";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// ctlSensor1
//
this.ctlSensor1.ColorOff = System.Drawing.Color.DimGray;
this.ctlSensor1.ColorOn = System.Drawing.Color.Lime;
this.ctlSensor1.Location = new System.Drawing.Point(468, 293);
this.ctlSensor1.MaximumSize = new System.Drawing.Size(80, 80);
this.ctlSensor1.MinimumSize = new System.Drawing.Size(40, 40);
this.ctlSensor1.Name = "ctlSensor1";
this.ctlSensor1.Size = new System.Drawing.Size(54, 48);
this.ctlSensor1.TabIndex = 142;
this.ctlSensor1.Value = true;
//
// m4
//
this.m4.Length = 100;
this.m4.Location = new System.Drawing.Point(277, 285);
this.m4.MaximumSize = new System.Drawing.Size(80, 80);
this.m4.MinimumSize = new System.Drawing.Size(40, 40);
this.m4.Name = "m4";
this.m4.Pin_DirCW = false;
this.m4.Pin_Max = false;
this.m4.Pin_Min = false;
this.m4.Pin_Run = false;
this.m4.Size = new System.Drawing.Size(80, 47);
this.m4.TabIndex = 141;
this.m4.TabStop = false;
//
// m3
//
this.m3.Length = 100;
this.m3.Location = new System.Drawing.Point(191, 285);
this.m3.MaximumSize = new System.Drawing.Size(80, 80);
this.m3.MinimumSize = new System.Drawing.Size(40, 40);
this.m3.Name = "m3";
this.m3.Pin_DirCW = false;
this.m3.Pin_Max = false;
this.m3.Pin_Min = false;
this.m3.Pin_Run = false;
this.m3.Size = new System.Drawing.Size(80, 47);
this.m3.TabIndex = 140;
this.m3.TabStop = false;
//
// m2
//
this.m2.Length = 100;
this.m2.Location = new System.Drawing.Point(105, 285);
this.m2.MaximumSize = new System.Drawing.Size(80, 80);
this.m2.MinimumSize = new System.Drawing.Size(40, 40);
this.m2.Name = "m2";
this.m2.Pin_DirCW = false;
this.m2.Pin_Max = false;
this.m2.Pin_Min = false;
this.m2.Pin_Run = false;
this.m2.Size = new System.Drawing.Size(80, 47);
this.m2.TabIndex = 140;
this.m2.TabStop = false;
//
// m1
//
this.m1.Length = 100;
this.m1.Location = new System.Drawing.Point(19, 285);
this.m1.MaximumSize = new System.Drawing.Size(80, 80);
this.m1.MinimumSize = new System.Drawing.Size(40, 40);
this.m1.Name = "m1";
this.m1.Pin_DirCW = false;
this.m1.Pin_Max = false;
this.m1.Pin_Min = false;
this.m1.Pin_Run = false;
this.m1.Size = new System.Drawing.Size(80, 47);
this.m1.TabIndex = 140;
this.m1.TabStop = false;
//
// mcv
//
this.mcv.Length = 100;
this.mcv.Location = new System.Drawing.Point(363, 285);
this.mcv.MaximumSize = new System.Drawing.Size(80, 80);
this.mcv.MinimumSize = new System.Drawing.Size(40, 40);
this.mcv.Name = "mcv";
this.mcv.Pin_DirCW = false;
this.mcv.Pin_Max = false;
this.mcv.Pin_Min = false;
this.mcv.Pin_Run = false;
this.mcv.Size = new System.Drawing.Size(80, 47);
this.mcv.TabIndex = 139;
this.mcv.TabStop = false;
//
// fEmulator
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 414);
this.Controls.Add(this.ctlSensor1);
this.Controls.Add(this.m4);
this.Controls.Add(this.m3);
this.Controls.Add(this.m2);
this.Controls.Add(this.m1);
this.Controls.Add(this.mcv);
this.Controls.Add(this.button1);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.panel1);
this.Name = "fEmulator";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "fEmulator";
this.Load += new System.EventHandler(this.fEmulator_Load);
this.panel1.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private arDev.AzinAxt.JogController jogController1;
private System.Windows.Forms.Panel panel1;
private arDev.AzinAxt.JogController jogController3;
private arDev.AzinAxt.JogController jogController2;
private arDev.AzinAxt.JogController jogController5;
private arDev.AzinAxt.JogController jogController4;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Panel panel2;
private arDev.AzinAxt.GridView tblDI;
private System.Windows.Forms.Label lbTitle1;
private System.Windows.Forms.Panel panel3;
private arDev.AzinAxt.GridView tblDO;
private System.Windows.Forms.Label lbtitle2;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button button1;
private UIControl.CtlMotor mcv;
private UIControl.CtlMotor m1;
private UIControl.CtlMotor m2;
private UIControl.CtlMotor m3;
private UIControl.CtlMotor m4;
private UIControl.CtlSensor ctlSensor1;
}
}

View File

@@ -0,0 +1,278 @@
using arDev.AzinAxt;
using arDev.AzinAxt.Emulator;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Project.Dialog
{
public partial class fEmulator : Form
{
public CEmuleDIO devIO { get; private set; }
public CEmulMOT devM { get; private set; }
JogController[] jobCtl;
public fEmulator(int pCnt,int aCnt, MOT mot)
{
InitializeComponent();
//motion
devM = new CEmulMOT(aCnt);
this.jobCtl = new JogController[] {
jogController1,jogController2,
jogController3,jogController4,
jogController5
};
foreach (var item in jobCtl)
{
item.arDebugMode = false;
item.ItemClick += Item_ItemClick;
}
for (int i = 0; i < aCnt; i++)
{
Boolean enb = i < aCnt;
jobCtl[i].MotionObject = mot;
jobCtl[i].Enabled = enb;
jobCtl[i].arUsage = enb;
jobCtl[i].arAutoUpdate = false;
jobCtl[i].Invalidate();
if (enb)
{
devM.MaxPosition[i] = jobCtl[i].arMaxLength;
devM.MinPosition[i] = jobCtl[i].arMinLength;
}
}
//input
devIO = new CEmuleDIO(pCnt);
devIO.IOValueChagned += Dev_IOValueChagned;
this.tblDI.SuspendLayout();
this.tblDO.SuspendLayout();
var pinNameI = new string[pCnt];
var pinNameO = new string[pCnt];
var pinTitleI = new string[pCnt];
var pinTitleO = new string[pCnt];
for (int i = 0; i < pinNameI.Length; i++)
{
pinNameI[i] = "X" + i.ToString("X2").PadLeft(3, '0');// Enum.GetName(typeof(ePLCIPin), i); //Enum.GetNames(typeof(eDIName))[i];// i.ToString();
pinTitleI[i] = string.Empty;// i.ToString();// Enum.GetName(typeof(ePLCITitle), i); //Enum.GetNames(typeof(eDITitle))[i];
}
for (int i = 0; i < pinNameO.Length; i++)
{
pinNameO[i] = "Y" + i.ToString("X2").PadLeft(3, '0');// Enum.GetName(typeof(ePLCOPin), i); // Enum.GetNames(typeof(eDOName))[i];
pinTitleO[i] = string.Empty;//i.ToString();// Enum.GetName(typeof(ePLCOTitle), i); // Enum.GetNames(typeof(eDOTitle))[i];
}
tblDI.MatrixSize = new Point(8, 8);
tblDO.MatrixSize = new Point(8, 8);
tblDI.setTitle(pinTitleI);
tblDO.setTitle(pinTitleO);
tblDI.setNames(pinNameI);
tblDO.setNames(pinNameO);
tblDI.setItemTextAlign(ContentAlignment.BottomLeft);
tblDO.setItemTextAlign(ContentAlignment.BottomLeft);
tblDI.setValue(devIO.Input);
tblDO.setValue(devIO.Output);
//dio.IOValueChanged += dio_IOValueChanged;
this.tblDI.ItemClick += tblDI_ItemClick;
this.tblDO.ItemClick += tblDO_ItemClick;
this.tblDI.Invalidate();
this.tblDO.Invalidate();
}
private void fEmulator_Load(object sender, EventArgs e)
{
timer1.Start();
}
private void Item_ItemClick(object sender, JogController.ItemClickEventArgs e)
{
//조그컨트롤에서 버튼을 누르면 동작하는 기능
JogController jog = sender as JogController;
arDev.AzinAxt.MOT mot = jog.MotionObject;
if (e.Button == MouseButtons.Left)
{
if (e.IsDown == false)
{
//마우스 업
if (e.Command.StartsWith("JOG"))
{
devM.dCmd[jog.arAxis] = devM.dAct[jog.arAxis];
mot.MoveStop("", (short)jog.arAxis);
}
}
else
{
//마우스 다운
if (e.Command == "HSET")
{
mot.isHomeSet[jog.arAxis] = !mot.isHomeSet[jog.arAxis];
Console.WriteLine("homse change : " + devM.isHSet[jog.arAxis].ToString());
}
else if (e.Command == "ALM")
{
//알람상태를 직접 변경해야한다
devM.SetMech(jog.arAxis, CEmulMOT.eMach.MotAlarm, !devM.isAlm(jog.arAxis));
}
else if (e.Command == "SVON")
{
var cVal = mot.isSERVOON[jog.arAxis];
mot.SetSVON((short)jog.arAxis, !cVal);
}
else if (e.Command == "ORG")
{
mot.Move((short)jog.arAxis, 0);
}
else if (e.Command == "JOGR")
{
mot.JOG((short)jog.arAxis, eMotionDirection.Positive);
}
else if (e.Command == "JOGL")
{
mot.JOG((short)jog.arAxis, eMotionDirection.Negative);
}
}
}
}
void tblDO_ItemClick(object sender, GridView.ItemClickEventArgs e)
{
var nVal = !devIO.Output[e.idx];//.Get(e.idx);// doValue[e.idx];// == 1 ? (ushort)0 : (ushort)1;
devIO.SetOutput(e.idx, nVal);
}
void tblDI_ItemClick(object sender, GridView.ItemClickEventArgs e)
{
var nVal = !devIO.Input[e.idx];
devIO.SetInput(e.idx, nVal);
}
private void Dev_IOValueChagned(object sender, CEmuleDIO.IOValueChangedArgs e)
{
if (e.Dir == CEmuleDIO.eDirection.In)
{
//해당 아이템의 값을 변경하고 다시 그린다.
if (tblDI.setValue(e.ArrIDX, e.NewValue))
tblDI.Invalidate();//.drawItem(e.ArrIDX);
Console.WriteLine(string.Format("di change {0}:{1}", e.ArrIDX, e.NewValue.ToString()));
}
else
{
//해당 아이템의 값을 변경하고 다시 그린다.
if (tblDO.setValue(e.ArrIDX, e.NewValue))
tblDO.Invalidate();//.drawItem(e.ArrIDX);
Console.WriteLine(string.Format("do change {0}:{1}", e.ArrIDX, e.NewValue.ToString()));
}
}
private void timer1_Tick(object sender, EventArgs e)
{
for (int i = 0; i < this.devM.axisCount; i++)
{
//각 축별 데이터를 표시한다
this.jobCtl[i].arIsOrg = devM.isOrg(i);
this.jobCtl[i].arIsInp = devM.isINp(i);
this.jobCtl[i].arIsAlm = devM.isAlm(i);
this.jobCtl[i].arIsLimM = devM.isLimM(i);
this.jobCtl[i].arIsLimP = devM.isLimP(i);
this.jobCtl[i].arIsSvON = devM.isSvOn(i);
this.jobCtl[i].ardAct = devM.dAct[i];
this.jobCtl[i].arIsInit = true;// MotionObject.IsInit;
this.jobCtl[i].arIsHSet = true;
this.jobCtl[i].Invalidate();
}
//motor 표시
mcv.Pin_Run = devIO.Output[(int)eDOName.CONV_RUN];
mcv.Pin_DirCW = true;
mcv.Invalidate();
m1.Pin_Run = devIO.Output[(int)eDOName.PORT1_MOT_RUN];
m1.Pin_DirCW = devIO.Output[(int)eDOName.PORT1_MOT_DIR];
m1.Invalidate();
m2.Pin_Run = devIO.Output[(int)eDOName.PORT2_MOT_RUN];
m2.Pin_DirCW = devIO.Output[(int)eDOName.PORT2_MOT_DIR];
m2.Invalidate();
m3.Pin_Run = devIO.Output[(int)eDOName.PORT3_MOT_RUN];
m3.Pin_DirCW = devIO.Output[(int)eDOName.PORT3_MOT_DIR];
m3.Invalidate();
m4.Pin_Run = devIO.Output[(int)eDOName.PORT4_MOT_RUN];
m4.Pin_DirCW = devIO.Output[(int)eDOName.PORT4_MOT_DIR];
m4.Invalidate();
}
private void button1_Click(object sender, EventArgs e)
{
//모터 svon
Pub.mot.SetSVON(true);
//emg on
devIO.SetInput((int)eDIName.BUT_EMGF, true);
devIO.SetInput((int)eDIName.BUT_EMGR, true);
devIO.SetInput((int)eDIName.AREA_PORT11, true);
devIO.SetInput((int)eDIName.AREA_PORT12, true);
devIO.SetInput((int)eDIName.AREA_PORT21, true);
devIO.SetInput((int)eDIName.AREA_PORT22, true);
devIO.SetInput((int)eDIName.AREA_PORT31, true);
devIO.SetInput((int)eDIName.AREA_PORT32, true);
devIO.SetInput((int)eDIName.AREA_PORT41, true);
devIO.SetInput((int)eDIName.AREA_PORT42, true);
//각포트는 하단에 있는걸로 한다
devIO.SetInput((int)eDIName.PORT1_LIM_UP, true);
devIO.SetInput((int)eDIName.PORT1_LIM_DN, false); //false가 감지
devIO.SetInput((int)eDIName.PORT1_DET_UP, true);
devIO.SetInput((int)eDIName.PORT1_DET_DN, true);
devIO.SetInput((int)eDIName.PORT2_LIM_UP, true);
devIO.SetInput((int)eDIName.PORT2_LIM_DN, false); //false가 감지
devIO.SetInput((int)eDIName.PORT2_DET_UP, true);
devIO.SetInput((int)eDIName.PORT2_DET_DN, true);
devIO.SetInput((int)eDIName.PORT3_LIM_UP, true);
devIO.SetInput((int)eDIName.PORT3_LIM_DN, false); //false가 감지
devIO.SetInput((int)eDIName.PORT3_DET_UP, true);
devIO.SetInput((int)eDIName.PORT3_DET_DN, true);
devIO.SetInput((int)eDIName.PORT4_LIM_UP, true);
devIO.SetInput((int)eDIName.PORT4_LIM_DN, false); //false가 감지
devIO.SetInput((int)eDIName.PORT4_DET_UP, true);
devIO.SetInput((int)eDIName.PORT4_DET_DN, true);
}
}
}

View File

@@ -0,0 +1,123 @@
<?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>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,205 @@
namespace Project
{
partial class fErrorException
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(fErrorException));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.panTitleBar = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
this.lbTitle = new System.Windows.Forms.Label();
this.btTeach = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panTitleBar.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(269, 19);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(80, 80);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.label1.Font = new System.Drawing.Font("맑은 고딕", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(10, 106);
this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(10);
this.label1.Size = new System.Drawing.Size(598, 50);
this.label1.TabIndex = 3;
this.label1.Text = "The program was terminated due to an unhandled error";
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.label2.Font = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label2.ForeColor = System.Drawing.Color.DodgerBlue;
this.label2.Location = new System.Drawing.Point(17, 159);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(507, 45);
this.label2.TabIndex = 4;
this.label2.Text = "Information for error reporting has been collected.\r\nThe collected information is" +
" shown below.\r\nPlease send to \"Chikyun.kim@amkor.co.kr\" including the situation " +
"before the error occurred.";
//
// textBox1
//
this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(50)))));
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox1.ForeColor = System.Drawing.Color.LightCoral;
this.textBox1.Location = new System.Drawing.Point(10, 218);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox1.Size = new System.Drawing.Size(598, 346);
this.textBox1.TabIndex = 5;
this.textBox1.Text = "test";
//
// panTitleBar
//
this.panTitleBar.BackColor = System.Drawing.Color.Maroon;
this.panTitleBar.Controls.Add(this.label3);
this.panTitleBar.Controls.Add(this.lbTitle);
this.panTitleBar.Dock = System.Windows.Forms.DockStyle.Top;
this.panTitleBar.Location = new System.Drawing.Point(1, 1);
this.panTitleBar.Name = "panTitleBar";
this.panTitleBar.Size = new System.Drawing.Size(617, 32);
this.panTitleBar.TabIndex = 133;
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("맑은 고딕", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label3.ForeColor = System.Drawing.Color.White;
this.label3.Location = new System.Drawing.Point(547, 6);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(61, 17);
this.label3.TabIndex = 61;
this.label3.Text = "[ Close ]";
this.label3.Click += new System.EventHandler(this.label3_Click);
//
// lbTitle
//
this.lbTitle.BackColor = System.Drawing.Color.Transparent;
this.lbTitle.Cursor = System.Windows.Forms.Cursors.Arrow;
this.lbTitle.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbTitle.Font = new System.Drawing.Font("Cambria", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbTitle.ForeColor = System.Drawing.Color.LightSkyBlue;
this.lbTitle.Location = new System.Drawing.Point(0, 0);
this.lbTitle.Name = "lbTitle";
this.lbTitle.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
this.lbTitle.Size = new System.Drawing.Size(617, 32);
this.lbTitle.TabIndex = 60;
this.lbTitle.Text = "UnhandledException";
this.lbTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btTeach
//
this.btTeach.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.btTeach.Cursor = System.Windows.Forms.Cursors.Hand;
this.btTeach.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btTeach.Font = new System.Drawing.Font("맑은 고딕", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.btTeach.ForeColor = System.Drawing.Color.DeepPink;
this.btTeach.Location = new System.Drawing.Point(1, 610);
this.btTeach.Margin = new System.Windows.Forms.Padding(0, 0, 5, 0);
this.btTeach.Name = "btTeach";
this.btTeach.Size = new System.Drawing.Size(617, 61);
this.btTeach.TabIndex = 134;
this.btTeach.Text = "Close";
this.btTeach.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.btTeach.Click += new System.EventHandler(this.btTeach_Click);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Controls.Add(this.textBox1);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.label2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(1, 33);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(617, 577);
this.panel1.TabIndex = 135;
//
// fErrorException
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
this.ClientSize = new System.Drawing.Size(619, 672);
this.Controls.Add(this.panel1);
this.Controls.Add(this.btTeach);
this.Controls.Add(this.panTitleBar);
this.Font = new System.Drawing.Font("맑은 고딕", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "fErrorException";
this.Padding = new System.Windows.Forms.Padding(1);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Error Report";
this.TopMost = true;
this.Load += new System.EventHandler(this.fErrorException_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.panTitleBar.ResumeLayout(false);
this.panTitleBar.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1;
public System.Windows.Forms.Panel panTitleBar;
private System.Windows.Forms.Label lbTitle;
private System.Windows.Forms.Label btTeach;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label3;
}
}

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Project
{
public partial class fErrorException : Form
{
public fErrorException(string err)
{
InitializeComponent();
System.Text.StringBuilder sb = new StringBuilder();
sb.AppendLine("===============================");
sb.AppendLine("Amkor Technology Korea");
sb.AppendLine("K4 EEDP");
sb.AppendLine("===============================");
sb.AppendLine();
sb.AppendLine(err);
this.textBox1.Text = sb.ToString();
this.lbTitle.MouseMove += LbTitle_MouseMove;
this.lbTitle.MouseUp += LbTitle_MouseUp;
this.lbTitle.MouseDown += LbTitle_MouseDown;
this.lbTitle.DoubleClick += LbTitle_DoubleClick;
}
private void fErrorException_Load(object sender, EventArgs e)
{
}
#region "Mouse Form Move"
private Boolean fMove = false;
private Point MDownPos;
private void LbTitle_DoubleClick(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized) this.WindowState = FormWindowState.Normal;
else this.WindowState = FormWindowState.Maximized;
}
private void LbTitle_MouseMove(object sender, MouseEventArgs e)
{
if (fMove)
{
Point offset = new Point(e.X - MDownPos.X, e.Y - MDownPos.Y);
this.Left += offset.X;
this.Top += offset.Y;
offset = new Point(0, 0);
}
}
private void LbTitle_MouseUp(object sender, MouseEventArgs e)
{
fMove = false;
}
private void LbTitle_MouseDown(object sender, MouseEventArgs e)
{
MDownPos = new Point(e.X, e.Y);
fMove = true;
}
#endregion
private void btTeach_Click(object sender, EventArgs e)
{
this.Close();
}
private void label3_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

View File

@@ -0,0 +1,144 @@
<?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>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAb
rQAAG60BIeRSlQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAPnSURBVHhe7dzJ
TttQFAbgdNFKnZ6GFWKDfCNGsWRRddO+ATwBo5g2iNdopU7LqlXVFgUa2LDoE7TbQoEIFpVw72/5EOdw
INO919fx/aVfiuwTD58chcFyJSQkJJu4Urm3H0Uv95Wq7VWrx2jyOopeYF06FiLlcGbmkQZ7v6dULFav
w0w6HpINYGpKfQbUj/Hx+Pf8fHy2thafra8nr7EsQYyiT7Xh4Yfp20KQLF59cjI+XlqKL7e3W4plWBcQ
WXZHRp5qkF3AHE5NxScrKzfwqFiHmRRxF+9NN1POdINHDYhpesGjlh6xHzxqaRE53t/VVRGok5YO0SQe
tTSINvCoLYhKfR84RJt41IFFdIFHxbYHCtElHpUjfhkdfZIeTrGS4OkTcIlHLTxinnjUwiLiQPPGoxYO
0Sc8amEQTePxSDOd1ntEG1cejzTTTb1FbMGbnjaCh/JIM93WO0RbeCiPNNNLs4g1pb7lhmgTD+WRZnpt
7oi28VAeaaaf5oaIHWGHNvFQHmmm3yaI+hycIbrCQ3mkGRN1hugSD+WRZkzVOqJrPJRHmjFZa4h54KE8
0ozpGkfMCw/lkWZs1BhinngojzRjq30j5o2H8kgzNptF3Ffqa8eIPuChPNKM7XaN6AseyiPNuChHPBob
e5xytQZ3f2q81xg80L/inCwvixt0VR5pxlVhAZMEsVp9Jd4pq1c+xwBuZMwbD+WRZlwWJnSTZy2KnqVs
zegVyR8Hfs3NiRtwXR5pxnVhAyN8lFO2ZvSKc6w839gQ3+y6PNKM68IGRrpnKVszemEjAN5d3K99F2D4
CLdpu49w+BK5o22/RMKPMbcXFm1/jEEOh4bu68vzLQbrExPx8eKiuEEX5ZFmXBQGsICJ7hsYpVxyfEHk
kWZst2s8ik9XYl7tGY9SZsQsHgy6xqOUEdEYHqVMiMbxKGVAtIZHcYq4sxP/q9fjq9PTpHiNZeKsgVrH
o/ycnX3gAhFgPAmiMNtv/ywsuMGjuEC8ajRStmawTJrtp87xKEDUv/a9s4XoAjA3PIpNRNsfYY6Hc0lP
y22sIdKXyMVF0gTP0JeIN3gUjogDlA7ch3qHRykCYhYPx+oNHsVnRO/xKD4iFgaPggOkpw/ljVg4PIoP
iIXFo+SJWHg8Ch7PpE/iI07kAI90cvCPKuwD+8I+se/CPyLK5ZWYvfKwz8JeeTwuEAcWj2ITceDxKDYQ
S4NHMYlYOjyKCcTS4lESRKU+9IKI2etHgpYRj9ILYsBj6QYx4N2S8BBaA5Eeg9zY3IwbW1vhMcidBoj0
7SxWr8NMOh4iBXd/Xj8KXqlLNHkdHgUfEnIjlcp/1rPAKpMPkMkAAAAASUVORK5CYII=
</value>
</data>
</root>

View File

@@ -0,0 +1,242 @@
namespace Project
{
partial class fTeach
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(fTeach));
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.btOpen = new System.Windows.Forms.ToolStripButton();
this.btSave = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.btFindEvision = new System.Windows.Forms.ToolStripButton();
this.btTestEvision = new System.Windows.Forms.ToolStripButton();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.panel1 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.tbGainOff = new System.Windows.Forms.TextBox();
this.tbErode = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.tbBarcodeList = new System.Windows.Forms.TextBox();
this.toolStripButton13 = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btOpen,
this.btSave,
this.toolStripSeparator2,
this.btFindEvision,
this.btTestEvision,
this.toolStripButton13});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(688, 25);
this.toolStrip1.TabIndex = 3;
this.toolStrip1.Text = "toolStrip1";
//
// btOpen
//
this.btOpen.Image = ((System.Drawing.Image)(resources.GetObject("btOpen.Image")));
this.btOpen.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btOpen.Name = "btOpen";
this.btOpen.Size = new System.Drawing.Size(56, 22);
this.btOpen.Text = "Open";
this.btOpen.Click += new System.EventHandler(this.toolStripButton1_Click);
//
// btSave
//
this.btSave.Image = ((System.Drawing.Image)(resources.GetObject("btSave.Image")));
this.btSave.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btSave.Name = "btSave";
this.btSave.Size = new System.Drawing.Size(52, 22);
this.btSave.Text = "Save";
this.btSave.Click += new System.EventHandler(this.toolStripButton4_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// btFindEvision
//
this.btFindEvision.Image = ((System.Drawing.Image)(resources.GetObject("btFindEvision.Image")));
this.btFindEvision.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btFindEvision.Name = "btFindEvision";
this.btFindEvision.Size = new System.Drawing.Size(95, 22);
this.btFindEvision.Text = "Find(Evision)";
this.btFindEvision.Click += new System.EventHandler(this.btFineEvision_Click);
//
// btTestEvision
//
this.btTestEvision.Image = ((System.Drawing.Image)(resources.GetObject("btTestEvision.Image")));
this.btTestEvision.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btTestEvision.Name = "btTestEvision";
this.btTestEvision.Size = new System.Drawing.Size(93, 22);
this.btTestEvision.Text = "Test(Evision)";
this.btTestEvision.Click += new System.EventHandler(this.toolStripButton3_Click);
//
// statusStrip1
//
this.statusStrip1.Location = new System.Drawing.Point(0, 606);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(688, 22);
this.statusStrip1.TabIndex = 4;
this.statusStrip1.Text = "statusStrip1";
//
// panel1
//
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.tbGainOff);
this.panel1.Controls.Add(this.tbErode);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 495);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(688, 111);
this.panel1.TabIndex = 5;
//
// button1
//
this.button1.Location = new System.Drawing.Point(112, 70);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(564, 29);
this.button1.TabIndex = 2;
this.button1.Text = "Save Setting";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// tbGainOff
//
this.tbGainOff.Location = new System.Drawing.Point(112, 42);
this.tbGainOff.Name = "tbGainOff";
this.tbGainOff.Size = new System.Drawing.Size(564, 21);
this.tbGainOff.TabIndex = 1;
//
// tbErode
//
this.tbErode.Location = new System.Drawing.Point(112, 14);
this.tbErode.Name = "tbErode";
this.tbErode.Size = new System.Drawing.Size(564, 21);
this.tbErode.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(15, 45);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(91, 12);
this.label2.TabIndex = 0;
this.label2.Text = "Gain Offset List";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(44, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 12);
this.label1.TabIndex = 0;
this.label1.Text = "Erode List";
//
// panel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 25);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(688, 405);
this.panel2.TabIndex = 6;
//
// tbBarcodeList
//
this.tbBarcodeList.Dock = System.Windows.Forms.DockStyle.Bottom;
this.tbBarcodeList.Location = new System.Drawing.Point(0, 430);
this.tbBarcodeList.Multiline = true;
this.tbBarcodeList.Name = "tbBarcodeList";
this.tbBarcodeList.ReadOnly = true;
this.tbBarcodeList.Size = new System.Drawing.Size(688, 65);
this.tbBarcodeList.TabIndex = 7;
//
// toolStripButton13
//
this.toolStripButton13.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.toolStripButton13.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton13.Image")));
this.toolStripButton13.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton13.Name = "toolStripButton13";
this.toolStripButton13.Size = new System.Drawing.Size(61, 22);
this.toolStripButton13.Text = "debug";
this.toolStripButton13.Click += new System.EventHandler(this.toolStripButton13_Click);
//
// fTeach
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(688, 628);
this.Controls.Add(this.panel2);
this.Controls.Add(this.tbBarcodeList);
this.Controls.Add(this.panel1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.toolStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "fTeach";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Vision Teach";
this.Load += new System.EventHandler(this.fTeach_Load);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripButton btOpen;
private System.Windows.Forms.ToolStripButton btFindEvision;
private System.Windows.Forms.ToolStripButton btTestEvision;
private System.Windows.Forms.ToolStripButton btSave;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox tbErode;
private System.Windows.Forms.TextBox tbGainOff;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TextBox tbBarcodeList;
private System.Windows.Forms.ToolStripButton toolStripButton13;
}
}

View File

@@ -0,0 +1,252 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AR;
#if V22
using Euresys.Open_eVision_22_12;
#else
using Euresys.Open_eVision_2_11;
#endif
namespace Project
{
public partial class fTeach : Form
{
EImageBW8 img = null;
private arCtl.ImageBoxEvision iv1;
public fTeach(EBaseROI img_ = null)
{
InitializeComponent();
this.iv1 = new arCtl.ImageBoxEvision();
this.iv1.BackColor = Color.Black;
this.iv1.Dock = DockStyle.Fill;
this.panel2.Controls.Add(iv1);
iv1.Dock = DockStyle.Fill;
if (img_ != null)
{
img = new EImageBW8();
img.SetSize(img_);
img_.CopyTo(this.img);
//EasyImage.Copy(img_, img);
this.iv1.Image = img;
this.iv1.Invalidate();
this.iv1.ZoomFit();
}
this.FormClosed += FTeach_FormClosed;
}
private void FTeach_FormClosed(object sender, FormClosedEventArgs e)
{
if (this.img != null) img.Dispose();
runtest = false;
}
private void fTeach_Load(object sender, EventArgs e)
{
this.tbErode.Text = PUB.setting.erodevaluestr;
this.tbGainOff.Text = PUB.setting.GainOffsetListStr;
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
//open file
OpenFileDialog od = new OpenFileDialog();
if (od.ShowDialog() == DialogResult.OK)
{
if (this.img != null) this.img.Dispose();
img = new EImageBW8();
img.Load(od.FileName);
this.iv1.Image = img;
this.iv1.Invalidate();
this.iv1.ZoomFit();
}
}
private void btFineEvision_Click(object sender, EventArgs e)
{
string resultMessage;
iv1.Shapes.Clear();
//using (EImageBW8 img = new EImageBW8(this.img.Width, this.img.Height))
{
//img.SetImagePtr(this.img.Width, this.img.Height, this.img.MIplImage.ImageData);
var pccnt = 0;
var qrrlt = Util_Vision.DetectQR(img, this.iv1, pccnt++,
out resultMessage,
tbErode.Text,
tbGainOff.Text,
PUB.setting.blob_area_min,
PUB.setting.blob_area_max,
PUB.setting.blob_sigmaxy,
PUB.setting.blob_sigmayy,
PUB.setting.blob_sigmaxx,
PUB.setting.blob_minw,
PUB.setting.blob_maxw,
PUB.setting.blob_minh,
PUB.setting.blob_maxh);
var list = qrrlt.Item1;
//PUB.ProcessTime[ECalibrationMode]
this.tbBarcodeList.Text = string.Join(",", list.Select(t => t.data).ToArray());
//
foreach (var item in list.OrderByDescending(t => t.sid))
{
Console.WriteLine("sid:" + item.sid);
}
}
this.iv1.ZoomFit();
}
Boolean runtest = false;
int runcount = 0;
private void toolStripButton3_Click(object sender, EventArgs e)
{
if (runtest)
{
runtest = false;
PUB.log_[0].Add($"Test completed({runcount})");
}
else
{
string resultMessage;
iv1.Shapes.Clear();
runcount = 0;
runtest = true;
PUB.log_[0].Add("Test Evision Start");
Task.Run(() =>
{
while (runtest)
{
Util_Vision.DetectQR(img, this.iv1, runcount++,
out resultMessage,
tbErode.Text,
tbGainOff.Text,
PUB.setting.blob_area_min,
PUB.setting.blob_area_max,
PUB.setting.blob_sigmaxy,
PUB.setting.blob_sigmayy,
PUB.setting.blob_sigmaxx,
PUB.setting.blob_minw,
PUB.setting.blob_maxw,
PUB.setting.blob_minh,
PUB.setting.blob_maxh);
}
});
}
}
private void toolStripButton4_Click(object sender, EventArgs e)
{
if (this.iv1.Image == null)
{
UTIL.MsgE("No image");
return;
}
var sd = new SaveFileDialog();
sd.FileName = "saveimage.bmp";
if (sd.ShowDialog() == DialogResult.OK)
this.iv1.Image.Save(sd.FileName);
}
private void button1_Click(object sender, EventArgs e)
{
PUB.setting.erodevaluestr = tbErode.Text;
PUB.setting.GainOffsetListStr = tbGainOff.Text;
PUB.setting.Save();
}
private void toolStripButton13_Click(object sender, EventArgs e)
{
this.iv1.DebugMode = !this.iv1.DebugMode;
this.iv1.Invalidate();
}
//private void toolStripButton6_Click(object sender, EventArgs e)
//{
// string resultMessage;
// iv1.ClearShape();
// using (EImageBW8 img = new EImageBW8(this.img.Width, this.img.Height))
// {
// img.SetImagePtr(this.img.Width, this.img.Height, this.img.MIplImage.ImageData);
// var pccnt = 0;
// var list = Util_Vision.DetectQR(img, this.iv1, pccnt++,
// out resultMessage,
// tbErode.Text,
// tbGainOff.Text,
// Pub.setting.blob_area_min,
// Pub.setting.blob_area_max,
// Pub.setting.blob_sigmaxy,
// Pub.setting.blob_sigmayy,
// Pub.setting.blob_sigmaxx,
// Pub.setting.blob_minw,
// Pub.setting.blob_maxw,
// Pub.setting.blob_minh,
// Pub.setting.blob_maxh,
// true);
// //
// foreach (var item in list.OrderByDescending(t => t.sid))
// {
// Console.WriteLine("sid:" + item.sid);
// }
// }
// this.iv1.ZoomFit();
//}
//private void toolStripButton5_Click(object sender, EventArgs e)
//{
// if (runtest)
// {
// runtest = false;
// Pub.log.Add($"테스트 종료({runcount})");
// }
// else
// {
// Pub.log.Add("Test Evision+Softtek Start");
// string resultMessage;
// iv1.ClearShape();
// runcount = 0;
// runtest = true;
// Task.Run(() =>
// {
// using (EImageBW8 img = new EImageBW8(this.img.Width, this.img.Height))
// {
// img.SetImagePtr(this.img.Width, this.img.Height, this.img.MIplImage.ImageData);
// while (runtest)
// {
// Util_Vision.DetectQR(img, this.iv1, runcount++,
// out resultMessage,
// tbErode.Text,
// tbGainOff.Text,
// Pub.setting.blob_area_min,
// Pub.setting.blob_area_max,
// Pub.setting.blob_sigmaxy,
// Pub.setting.blob_sigmayy,
// Pub.setting.blob_sigmaxx,
// Pub.setting.blob_minw,
// Pub.setting.blob_maxw,
// Pub.setting.blob_minh,
// Pub.setting.blob_maxh,
// true);
// }
// }
// });
// }
//}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,97 @@
namespace Project
{
partial class fviewer
{
/// <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()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(fviewer));
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.sbConnState = new System.Windows.Forms.ToolStripStatusLabel();
this.piv = new System.Windows.Forms.Panel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.sbConnState});
this.statusStrip1.Location = new System.Drawing.Point(0, 625);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 12, 0);
this.statusStrip1.Size = new System.Drawing.Size(854, 24);
this.statusStrip1.TabIndex = 4;
this.statusStrip1.Text = "statusStrip1";
//
// sbConnState
//
this.sbConnState.Font = new System.Drawing.Font("맑은 고딕", 10F);
this.sbConnState.Name = "sbConnState";
this.sbConnState.Size = new System.Drawing.Size(23, 19);
this.sbConnState.Text = "●";
//
// piv
//
this.piv.Dock = System.Windows.Forms.DockStyle.Fill;
this.piv.Location = new System.Drawing.Point(0, 0);
this.piv.Name = "piv";
this.piv.Size = new System.Drawing.Size(854, 625);
this.piv.TabIndex = 6;
this.piv.MouseClick += new System.Windows.Forms.MouseEventHandler(this.piv_MouseClick);
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// fviewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(854, 649);
this.Controls.Add(this.piv);
this.Controls.Add(this.statusStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Name = "fviewer";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Image viewer";
this.Load += new System.EventHandler(this.fTeach_Load);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.Panel piv;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.ToolStripStatusLabel sbConnState;
}
}

View File

@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AR;
#if V22
using Euresys.Open_eVision_22_12;
#else
using Euresys.Open_eVision_2_11;
#endif
namespace Project
{
public partial class fviewer : Form
{
int Camidx = 0;
EImageBW8 img = null;
private arCtl.ImageBoxEvision iv1;
public fviewer(int camidx)
{
InitializeComponent();
PUB.imgque.Push(this.Name);
this.Camidx = camidx;
//this.iv1 = new arCtl.ImageBoxEvision();
//this.iv1.BackColor = Color.Black;
//this.iv1.Dock = DockStyle.Fill;
//this.piv.Controls.Add(iv1);
//iv1.Dock = DockStyle.Fill;
//if (img_ != null)
//{
// img = new EImageBW8();
// img.SetSize(img_);
// img_.CopyTo(this.img);
// EasyImage.Copy(img_, img);
// this.iv1.Image = img;
// this.iv1.Invalidate();
// this.iv1.ZoomFit();
//}
this.KeyDown += (s1, e1) => {
if (e1.KeyCode == Keys.Escape) this.Close();
};
this.FormClosed += FTeach_FormClosed;
this.WindowState = FormWindowState.Maximized;
}
private void FTeach_FormClosed(object sender, FormClosedEventArgs e)
{
this.timer1.Stop();
PUB.imgque.Pop();
if (this.img != null) img.Dispose();
runtest = false;
}
private void fTeach_Load(object sender, EventArgs e)
{
this.timer1.Start();
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
//open file
OpenFileDialog od = new OpenFileDialog();
if (od.ShowDialog() == DialogResult.OK)
{
if (this.img != null) this.img.Dispose();
img = new EImageBW8();
img.Load(od.FileName);
this.iv1.Image = img;
this.iv1.Invalidate();
this.iv1.ZoomFit();
}
}
Boolean runtest = false;
int runcount = 0;
private void toolStripButton4_Click(object sender, EventArgs e)
{
if (this.iv1.Image == null)
{
UTIL.MsgE("No image");
return;
}
var sd = new SaveFileDialog();
sd.FileName = "saveimage.bmp";
if (sd.ShowDialog() == DialogResult.OK)
this.iv1.Image.Save(sd.FileName);
}
private void toolStripButton13_Click(object sender, EventArgs e)
{
this.iv1.DebugMode = !this.iv1.DebugMode;
this.iv1.Invalidate();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (this.IsDisposed == true || this.Disposing == true) return;
if (PUB.imgque.Peek().Equals(this.Name) == false) return;
//카메라가 연결되지 않았따면 처리하지 않는다.
if (PUB._isCrevisOpen[Camidx] == false || PUB.flag.get(eFlag.CAMERAINIT) == false)
{
}
else
{
//이미지수집후 데이터 처리
if (PUB.CrevisGrab(this.Camidx, true,this.piv))
{
//if (IsProcess[Camidx] || IsTrigger[Camidx])
PUB.CreavisProcess(Camidx, true, this.piv);// IsTrigger[Camidx]);
}
}
//heart beat
//this.BeginInvoke(new Action(() =>
//{
if (sbConnState.ForeColor == Color.Green)
sbConnState.ForeColor = Color.LimeGreen;
else
sbConnState.ForeColor = Color.Green;
//}));
}
private void piv_MouseClick(object sender, MouseEventArgs e)
{
this.Close();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
namespace arCtl
{
partial class LogTextBox
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -0,0 +1,347 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace arCtl
{
public partial class LogTextBox : RichTextBox
{
delegate void AddMsgHandler(DateTime tm, string Gubun, string Msg, Color fColor);
/// <summary>
/// 타이머를 이용하여 로그를 표시할 것인가를 설정합니다. (데이터량이 너무 많다면 이기능을사용하세요. 버퍼오버가 되면 프로그램이 멈출수 있습니다)
/// </summary>
public Boolean EnableDisplayTimer
{
get
{
return tm.Enabled;
}
set
{
tm.Enabled = value;
if (value) tm.Start();
else tm.Stop();
}
}
/// <summary>
/// 날짜의 포맷방식 기본 (yy-MM-dd HH:mm:ss)
/// </summary>
public string DateFormat { get; set; }
/// <summary>
/// 데이터의 String.Format 기본값([{0}] {1}), 0번은 시간, 1번은 메세지 , 2번은 구분
/// </summary>
public string ListFormat { get; set; }
/// <summary>
/// 최대 데이터의 줄수 , 지정값을 넘어서면 초기화 됩니다.
/// </summary>
public UInt16 MaxListCount { get; set; }
public UInt32 MaxTextLength { get; set; }
private sLogMessageColor[] _ColorList = new sLogMessageColor[] { };
/// <summary>
/// 메세지버퍼동기화를 위해서 추가함
/// </summary>
private System.Threading.AutoResetEvent ar = new System.Threading.AutoResetEvent(true);
ManualResetEvent mre = new ManualResetEvent(true);
object lock_work = new object();
/// <summary>
/// 메세지를 표시하는 내부 타이머의 간격입니다. 기본값 100
/// </summary>
public int MessageInterval
{
get
{
return tm.Interval;
}
set
{
tm.Interval = value;
//tm.Change(1000, value);
}
}
/// <summary>
/// 각 데이터라인을 컬러로 구분짓습니다.
/// </summary>
public Boolean EnableGubunColor { get; set; }
public System.Windows.Forms.Timer tm;
public new void Dispose()
{
this.tm.Stop();
tm.Tick -= tm_Tick;
base.Dispose();
}
/// <summary>
/// 구분별로 색상을 입력합니다. 이 색상은 EnableGUbunColor 가 활성하되어야합니다. 비활성화시에는 DefaultColor를 사용합니다.
/// </summary>
public sLogMessageColor[] ColorList
{
get
{
return _ColorList;
}
set
{
_ColorList = value;
}
}
public LogTextBox()
{
InitializeComponent();
EnableGubunColor = true;
DateFormat = "yy-MM-dd HH:mm:ss";
ListFormat = "[{0}] {1}";
MaxListCount = 200;
MaxTextLength = 4000;
this.DefaultColor = Color.LightGray;
this.BackColor = Color.FromArgb(24, 24, 24);
this.Font = new Font("Consolas", 9, FontStyle.Regular);
// this.waitsEvent = new EventWaitHandle[] { waitEvent, closeAllEvent };
tm = new System.Windows.Forms.Timer(); // System.Threading.Timer(tm_Tick, ar, 1000, 3000);
// tm = new Timer();
tm.Interval = 50;
tm.Tick += tm_Tick;
this.EnableDisplayTimer = true;
tm.Start();
}
[Description("기본 글자 색상")]
[Browsable(true)]
public Color DefaultColor { get; set; }
public void AddMsg(DateTime tm, string Gubun, string Msg)
{
Boolean useColor = false;
Color fcolor = DefaultColor;
if (EnableGubunColor)
{
if (ColorList != null && ColorList.Length > 0)
{
foreach (var cdata in ColorList)
{
if (Gubun.StartsWith(cdata.gubun))
{
useColor = true;
fcolor = cdata.color;
break;
}
}
}
//사용자 컬러리스트를 조회해서 없다면 시스템으로 한다.
if (!useColor)
{
var sColorList = new sLogMessageColor[] {
new sLogMessageColor("ERR",Color.Red) ,
new sLogMessageColor("ATT",Color.Orange) ,
new sLogMessageColor("INFO",Color.DeepSkyBlue) ,
new sLogMessageColor("NET",Color.Magenta)
};
foreach (var cdata in sColorList)
{
if (Gubun.StartsWith(cdata.gubun))
{
fcolor = cdata.color;
break;
}
}
}
}
AddMsg(tm, Gubun, Msg, fcolor);
}
struct sMessageData
{
public DateTime date;
public string msg;
public Color fcolor;
}
public int BufferCount { get { return messagebuffer.Count; } }
void tm_Tick(object sender, EventArgs e)
{
//ar.WaitOne();
//ar.Reset();
if (!mre.WaitOne(2000)) return;
mre.Reset();
lock (lock_work)
{
if (messagebuffer.Count > 0)
{
var data = (sMessageData)messagebuffer.Dequeue();
//messagebuffer.RemoveAt(0);
AppendMessge(data.msg, data.fcolor);
//if (!this.IsDisposed && !this.Disposing)
//{
// //색상변경
// int StartIndex = this.TextLength;
// this.AppendText(data.msg + "\r\n");
// this.Select(StartIndex, data.msg.Length);
// this.SelectionColor = data.fcolor;
// this.ScrollToCaret();
//}
}
}
mre.Set();
// AppendMessge(DateTime.Now.ToString("HH:mm:ss.fff"),Color.White);
// ar.Set();
}
delegate void AppedMessageHandler(string msg, Color fColor);
void AppendMessge(string ListStr, Color fColor)
{
if (!this.Disposing && !this.IsDisposed)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new AppedMessageHandler(AppendMessge), new object[] { ListStr, fColor });
}
else
{
if (this.TextLength > MaxTextLength) this.Clear();
int StartIndex = this.TextLength;
this.AppendText(ListStr + "\r\n");
this.Select(StartIndex, ListStr.Length);
this.SelectionColor = fColor;
this.ScrollToCaret();
}
}
}
System.Collections.Queue messagebuffer = new System.Collections.Queue();
public void AddMsg(DateTime tm, string Gubun, string Msg, Color fColor)
{
//시간포맷
string _TimeFormat = this.DateFormat;
if (string.IsNullOrEmpty(_TimeFormat)) _TimeFormat = "yy-MM-dd HH:mm:ss";
//데이터포맷
string _ListFormat = this.ListFormat;
if (string.IsNullOrEmpty(_ListFormat)) _ListFormat = "[{0}] {1}";
string TimeStr = tm.ToString(_TimeFormat);
string ListStr = string.Format(_ListFormat, TimeStr, Msg);
//ar.WaitOne();
//ar.Reset();
if (!mre.WaitOne(2000)) return;
mre.Reset();
lock (lock_work)
{
///최대줄수를 넘어서면 오류
if (this.messagebuffer.Count > MaxListCount)
{
messagebuffer.Clear();
//this.Clear();
}
if (!EnableDisplayTimer)
{
AppendMessge(ListStr, fColor);
}
else
{
sMessageData newmsg = new sMessageData();
newmsg.msg = ListStr;
newmsg.date = tm;
newmsg.fcolor = fColor;
messagebuffer.Enqueue(newmsg);
}
mre.Set();
}
//ar.Set();
////색상변경
//int StartIndex = this.TextLength;
//this.AppendText(ListStr + "\r\n");
//this.Select(StartIndex, ListStr.Length);
//this.SelectionColor = fColor;
//this.ScrollToCaret();
}
public void AddMsg(DateTime tm, string Gubun, string[] Msg)
{
foreach (string m in Msg)
AddMsg(tm, Gubun, m);
}
public void AddMsg(string Gubun, string Msg)
{
AddMsg(DateTime.Now, Gubun, Msg);
}
public void AddMsg(string Gubun, string[] Msg)
{
foreach (string m in Msg)
AddMsg(DateTime.Now, Gubun, m);
}
public void AddMsg(string Msg)
{
AddMsg(DateTime.Now, "NORMAL", Msg);
}
public void AddMsg(string[] Msg)
{
foreach (string m in Msg)
AddMsg(DateTime.Now, "NORMAL", m);
}
}
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class sLogMessageColor
{
public string gubun { get; set; }
public Color color { get; set; }
public sLogMessageColor()
{
this.gubun = "NOR";
this.color = Color.White;
}
public sLogMessageColor(string g, Color c)
{
this.gubun = g;
this.color = c;
}
}
}

1142
QRValidation/Project/PUB.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
using System.Threading;
using System.Diagnostics;
namespace Project
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
if (CheckSingleInstance() == false) return;
PUB.initCore();
Application.Run(new fMain());
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string emsg = "Fatal Error(UHE)\n\n" + e.ExceptionObject.ToString();
PUB.log_[0].AddE(emsg);
PUB.log_[0].Flush();
PUB.log_[1].AddE(emsg);
PUB.log_[1].Flush();
Util.SaveBugReport(emsg);
Shutdown();
var f = new fErrorException(emsg);
f.ShowDialog();
Application.ExitThread();
}
/// <summary>
/// Check for duplicate execution prevention
/// </summary>
/// <returns>true if single instance, false if duplicate execution</returns>
static bool CheckSingleInstance()
{
string processName = Process.GetCurrentProcess().ProcessName;
Process[] processes = Process.GetProcessesByName(processName);
if (processes.Length > 1)
{
// 중복실행 감지
string message = $"⚠️ {Application.ProductName} program is already running!\n\n" +
"Cannot run multiple programs simultaneously.\n\n" +
"Please select a solution:";
var result = MessageBox.Show(message + "\n\nYes(Y): Terminate existing program and start new\nNo(N): Cancel current execution",
"Duplicate Execution Detected",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
// 기존 프로세스들을 종료
try
{
int currentProcessId = Process.GetCurrentProcess().Id;
foreach (Process process in processes)
{
if (process.Id != currentProcessId)
{
process.Kill();
process.WaitForExit(3000); // 3초 대기
}
}
// 잠시 대기 후 계속 진행
Thread.Sleep(1000);
return true;
}
catch (Exception ex)
{
MessageBox.Show($"An error occurred while terminating the existing program:\n{ex.Message}\n\n" +
"Please terminate manually in Task Manager.",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
else
{
// 현재 실행을 취소
return false;
}
}
return true; // 단일 인스턴스
}
static void Shutdown()
{
PUB.log_[0].Add("Program Close");
PUB.log_[0].Flush();
PUB.log_[1].Add("Program Close");
PUB.log_[1].Flush();
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
string emsg = "Fatal Error(ATE)\n\n" + e.Exception.ToString();
PUB.log_[0].AddE(emsg);
PUB.log_[0].Flush();
PUB.log_[1].AddE(emsg);
PUB.log_[1].Flush();
AR.UTIL.SaveBugReport(emsg);
Shutdown();
var f = new fErrorException(emsg);
f.ShowDialog();
Application.ExitThread();
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("※ Crevis QR-Code Reader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Amkor K4")]
[assembly: AssemblyProduct("※ Crevis QR-Code Reader")]
[assembly: AssemblyCopyright("Copyright ©Amkor-EET 2021")]
[assembly: AssemblyTrademark("EET")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("65f3e762-800c-772e-1818-b444642ec59f")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("25.01.13.1120")]
[assembly: AssemblyFileVersion("25.01.13.1120")]

View File

@@ -0,0 +1,173 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Project.Properties {
using System;
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Project.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대한 현재 스레드의 CurrentUICulture
/// 속성을 재정의합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_cancel_40 {
get {
object obj = ResourceManager.GetObject("icons8-cancel-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_checked_40 {
get {
object obj = ResourceManager.GetObject("icons8-checked-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_checked_radio_button_48 {
get {
object obj = ResourceManager.GetObject("icons8-checked-radio-button-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_copy_40 {
get {
object obj = ResourceManager.GetObject("icons8-copy-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_exercise_40 {
get {
object obj = ResourceManager.GetObject("icons8-exercise-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_new_40 {
get {
object obj = ResourceManager.GetObject("icons8-new-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_no_running_40 {
get {
object obj = ResourceManager.GetObject("icons8-no-running-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_plus_40 {
get {
object obj = ResourceManager.GetObject("icons8-plus-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_running_40 {
get {
object obj = ResourceManager.GetObject("icons8-running-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_save_40 {
get {
object obj = ResourceManager.GetObject("icons8-save-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap icons8_unavailable_40 {
get {
object obj = ResourceManager.GetObject("icons8-unavailable-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -0,0 +1,154 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="icons8-plus-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-plus-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-no-running-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-no-running-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-save-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-save-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-unavailable-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-unavailable-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-new-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-new-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-checked-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-checked-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-exercise-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-exercise-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-running-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-running-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-checked-radio-button-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-checked-radio-button-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-cancel-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-cancel-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-copy-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-copy-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Project.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("BLUPRT.CBX012020_rzDFf7pQAsCS")]
public string chilkat {
get {
return ((string)(this["chilkat"]));
}
set {
this["chilkat"] = value;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://k1xip00.amkor.co.kr:50000/XISOAPAdapter/MessageServlet?senderParty=&sender" +
"Service=eCIM_ATK&receiverParty=&receiverService=&interface=ZK_RFID_TRANS_SEQ&int" +
"erfaceNamespace=urn%3Asap-com%3Adocument%3Asap%3Arfc%3Afunctions")]
public string Logistics_Vision_wr_ZK_RFID_TRANS_SEQService {
get {
return ((string)(this["Logistics_Vision_wr_ZK_RFID_TRANS_SEQService"]));
}
}
}
}

View File

@@ -0,0 +1,12 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Project.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="chilkat" Type="System.String" Scope="User">
<Value Profile="(Default)">BLUPRT.CBX012020_rzDFf7pQAsCS</Value>
</Setting>
<Setting Name="Logistics_Vision_wr_ZK_RFID_TRANS_SEQService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://k1xip00.amkor.co.kr:50000/XISOAPAdapter/MessageServlet?senderParty=&amp;senderService=eCIM_ATK&amp;receiverParty=&amp;receiverService=&amp;interface=ZK_RFID_TRANS_SEQ&amp;interfaceNamespace=urn%3Asap-com%3Adocument%3Asap%3Arfc%3Afunctions</Value>
</Setting>
</Settings>
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

View File

@@ -0,0 +1,195 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using AR;
using System.Drawing.Design;
namespace Project
{
public class CSetting : AR.Setting
{
public System.Drawing.Rectangle ROI_ReelDetect_L { get; set; }
public System.Drawing.Rectangle ROI_ReelDetect_R { get; set; }
public System.Drawing.Rectangle ROI_ConvDetect_L { get; set; }
public System.Drawing.Rectangle ROI_ConvDetect_R { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public int ConvDetectValueL { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public int ConvDetectValueR { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public string cameraname { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public int GrabDelayFast { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public int GrabDelaySlow { get; set; }
[Description("Unit(seconds)"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public int TriggerTimeout { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public int AutoDeleteSeconds { get; set; }
public Boolean SendRawData { get; set; }
public Boolean DisableStreamData { get; set; }
public Boolean EnableDupRun { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public string ImageSavePath { get; set; }
public Boolean Log_AllBarcode { get; set; }
public Boolean Log_Ping { get; set; }
public Boolean Log_BarcodeTx { get; set; }
public Boolean Log_BarcodeRx { get; set; }
[Category("Developer Setting"), DisplayName("Listening Port(Left)"),
Description("Listening port for server communication(TCP) - Default: 7979")]
public int listenPortL { get; set; }
[Category("Developer Setting"), DisplayName("Listening Port(Right)"),
Description("Listening port for server communication(TCP) - Default: 7980")]
public int listenPortR { get; set; }
[Category("Save Data Path"), DisplayName("Data Save Path")]
public string Path_Data { get; set; }
[Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public int processCount { get; set; }
[Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public string erodevaluestr { get; set; }
[Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public uint blob_area_min { get; set; }
[Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public uint blob_area_max { get; set; }
[Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public float blob_sigmaxy { get; set; }
[Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public float blob_sigmayy { get; set; }
[Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public float blob_sigmaxx { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public float blob_rosscaleX { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public float blob_rosscaleY { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public float blob_minw { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public float blob_maxw { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public float blob_minh { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
public float blob_maxh { get; set; }
[Category("Vision")]
public Boolean SaveErrorImage { get; set; }
[Category("Vision")]
public string GainOffsetListStr { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor)), Description("Enter -1 if not used")]
public int CameraIndexL { get; set; }
[Editor(typeof(MyUITypeEditor), typeof(UITypeEditor)), Description("Enter -1 if not used")]
public int CameraIndexR { get; set; }
[Category("General Setting"), Browsable(false)]
public string Password_Setup { get; set; }
[Category("General Setting"), DisplayName("Full Screen Window State"),
Description("Use full screen mode.")]
public Boolean FullScreen { get; set; }
[Category("General Setting")]
public Boolean EnableDebugMode { get; set; }
public override void AfterLoad()
{
if (blob_minh == 0 && blob_maxh == 0)
{
blob_minh = 70;
blob_maxh = 190;
}
if (blob_minw == 0 && blob_maxw == 0)
{
blob_minw = 70;
blob_maxw = 190;
}
//if (TriggerTimeout == 0) TriggerTimeout = 30;
if (GrabDelayFast == 0) GrabDelayFast = 250;
if (GrabDelaySlow == 0) GrabDelaySlow = 500;
if (ImageSavePath.isEmpty()) ImageSavePath = Util.CurrentPath;
if (AutoDeleteSeconds == 0) AutoDeleteSeconds = 10;
if (blob_rosscaleX == 0) blob_rosscaleX = 1.5f;
if (blob_rosscaleY == 0) blob_rosscaleY = 1.5f;
if (processCount == 0 && blob_area_min == 0)
{
processCount = 6;
erodevaluestr = "3,1";
blob_area_min = 5000;
blob_area_max = 50000;
blob_sigmaxy = 500f;
blob_sigmaxx = 5000f;
blob_sigmayy = 500f;
}
if (GainOffsetListStr.isEmpty())
{
GainOffsetListStr = "1,0;1.3,0;1,50;1,-50;3,50;0.5,-20;2.5,150;2,0";
}
if (listenPortL == 0) listenPortL = 7979;
if (listenPortR == 0) listenPortR = 7980;
if (Password_Setup.isEmpty()) Password_Setup = "0000";
if (Path_Data == "")
Path_Data = System.IO.Path.Combine(Util.CurrentPath, "SaveData");
try
{
if (System.IO.Directory.Exists(Path_Data) == false)
System.IO.Directory.CreateDirectory(Path_Data);
}
catch
{
}
//if (Password_User.isEmpty()) Password_User = "9999";
}
public override void AfterSave()
{
//throw new NotImplementedException();
}
public void CopyTo(CSetting dest)
{
//이곳의 모든 쓰기가능한 속성값을 대상에 써준다.
Type thClass = this.GetType();
foreach (var method in thClass.GetMethods())
{
var parameters = method.GetParameters();
if (!method.Name.StartsWith("get_")) continue;
string keyname = method.Name.Substring(4);
string methodName = method.Name;
object odata = GetType().GetMethod(methodName).Invoke(this, null);
var wMethod = dest.GetType().GetMethod(Convert.ToString("set_") + keyname);
if (wMethod != null) wMethod.Invoke(dest, new object[] { odata });
}
}
}
}

View File

@@ -0,0 +1,497 @@
namespace Project
{
partial class fSetting
{
/// <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()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(fSetting));
this.button1 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.panel2 = new System.Windows.Forms.Panel();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.bindingNavigatorAddNewItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorCountItem = new System.Windows.Forms.ToolStripLabel();
this.bindingNavigatorDeleteItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorMoveFirstItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorMovePreviousItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorSeparator = new System.Windows.Forms.ToolStripSeparator();
this.bindingNavigatorPositionItem = new System.Windows.Forms.ToolStripTextBox();
this.bindingNavigatorSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.bindingNavigatorMoveNextItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorMoveLastItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButton5 = new System.Windows.Forms.ToolStripButton();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.toolStripButton6 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton7 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton8 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButton9 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton10 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButton11 = new System.Windows.Forms.ToolStripButton();
this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
this.toolStripButton12 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton13 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton14 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripTextBox2 = new System.Windows.Forms.ToolStripTextBox();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButton15 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton16 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
this.panel1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
this.button1.Location = new System.Drawing.Point(5, 5);
this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(601, 53);
this.button1.TabIndex = 0;
this.button1.Text = "Save(&S)";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// panel1
//
this.panel1.Controls.Add(this.button1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 557);
this.panel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.panel1.Name = "panel1";
this.panel1.Padding = new System.Windows.Forms.Padding(5);
this.panel1.Size = new System.Drawing.Size(611, 63);
this.panel1.TabIndex = 1;
//
// propertyGrid1
//
this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyGrid1.Font = new System.Drawing.Font("맑은 고딕", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.propertyGrid1.LineColor = System.Drawing.SystemColors.ControlDark;
this.propertyGrid1.Location = new System.Drawing.Point(3, 3);
this.propertyGrid1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.Size = new System.Drawing.Size(597, 518);
this.propertyGrid1.TabIndex = 1;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(611, 557);
this.tabControl1.TabIndex = 2;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.propertyGrid1);
this.tabPage1.Location = new System.Drawing.Point(4, 29);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(603, 524);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Advanced";
this.tabPage1.UseVisualStyleBackColor = true;
//
// panel2
//
this.panel2.Controls.Add(this.textBox1);
this.panel2.Controls.Add(this.label1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(3, 322);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(597, 199);
this.panel2.TabIndex = 6;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(10, 38);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(575, 148);
this.textBox1.TabIndex = 2;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 11);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(61, 12);
this.label1.TabIndex = 0;
this.label1.Text = "Mail Subject:";
//
// bindingNavigatorAddNewItem
//
this.bindingNavigatorAddNewItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorAddNewItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorAddNewItem.Image")));
this.bindingNavigatorAddNewItem.Name = "bindingNavigatorAddNewItem";
this.bindingNavigatorAddNewItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorAddNewItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorAddNewItem.Text = "Add New";
//
// bindingNavigatorCountItem
//
this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem";
this.bindingNavigatorCountItem.Size = new System.Drawing.Size(27, 22);
this.bindingNavigatorCountItem.Text = "/{0}";
this.bindingNavigatorCountItem.ToolTipText = "Total items";
//
// bindingNavigatorDeleteItem
//
this.bindingNavigatorDeleteItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorDeleteItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorDeleteItem.Image")));
this.bindingNavigatorDeleteItem.Name = "bindingNavigatorDeleteItem";
this.bindingNavigatorDeleteItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorDeleteItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorDeleteItem.Text = "Delete";
//
// bindingNavigatorMoveFirstItem
//
this.bindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorMoveFirstItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveFirstItem.Image")));
this.bindingNavigatorMoveFirstItem.Name = "bindingNavigatorMoveFirstItem";
this.bindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorMoveFirstItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorMoveFirstItem.Text = "Move first";
//
// bindingNavigatorMovePreviousItem
//
this.bindingNavigatorMovePreviousItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorMovePreviousItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMovePreviousItem.Image")));
this.bindingNavigatorMovePreviousItem.Name = "bindingNavigatorMovePreviousItem";
this.bindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorMovePreviousItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorMovePreviousItem.Text = "Move previous";
//
// bindingNavigatorSeparator
//
this.bindingNavigatorSeparator.Name = "bindingNavigatorSeparator";
this.bindingNavigatorSeparator.Size = new System.Drawing.Size(6, 25);
//
// bindingNavigatorPositionItem
//
this.bindingNavigatorPositionItem.AccessibleName = "Position";
this.bindingNavigatorPositionItem.AutoSize = false;
this.bindingNavigatorPositionItem.Name = "bindingNavigatorPositionItem";
this.bindingNavigatorPositionItem.Size = new System.Drawing.Size(50, 23);
this.bindingNavigatorPositionItem.Text = "0";
this.bindingNavigatorPositionItem.ToolTipText = "Current position";
//
// bindingNavigatorSeparator1
//
this.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator1";
this.bindingNavigatorSeparator1.Size = new System.Drawing.Size(6, 25);
//
// bindingNavigatorMoveNextItem
//
this.bindingNavigatorMoveNextItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorMoveNextItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveNextItem.Image")));
this.bindingNavigatorMoveNextItem.Name = "bindingNavigatorMoveNextItem";
this.bindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorMoveNextItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorMoveNextItem.Text = "Move next";
//
// bindingNavigatorMoveLastItem
//
this.bindingNavigatorMoveLastItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorMoveLastItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveLastItem.Image")));
this.bindingNavigatorMoveLastItem.Name = "bindingNavigatorMoveLastItem";
this.bindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorMoveLastItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorMoveLastItem.Text = "Move last";
//
// bindingNavigatorSeparator2
//
this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2";
this.bindingNavigatorSeparator2.Size = new System.Drawing.Size(6, 25);
//
// toolStripButton5
//
this.toolStripButton5.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton5.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton5.Image")));
this.toolStripButton5.Name = "toolStripButton5";
this.toolStripButton5.RightToLeftAutoMirrorImage = true;
this.toolStripButton5.Size = new System.Drawing.Size(23, 22);
this.toolStripButton5.Text = "Add New";
//
// toolStripLabel1
//
this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new System.Drawing.Size(27, 22);
this.toolStripLabel1.Text = "/{0}";
this.toolStripLabel1.ToolTipText = "Total items";
//
// toolStripButton6
//
this.toolStripButton6.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton6.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton6.Image")));
this.toolStripButton6.Name = "toolStripButton6";
this.toolStripButton6.RightToLeftAutoMirrorImage = true;
this.toolStripButton6.Size = new System.Drawing.Size(23, 22);
this.toolStripButton6.Text = "Delete";
//
// toolStripButton7
//
this.toolStripButton7.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton7.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton7.Image")));
this.toolStripButton7.Name = "toolStripButton7";
this.toolStripButton7.RightToLeftAutoMirrorImage = true;
this.toolStripButton7.Size = new System.Drawing.Size(23, 22);
this.toolStripButton7.Text = "Move first";
//
// toolStripButton8
//
this.toolStripButton8.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton8.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton8.Image")));
this.toolStripButton8.Name = "toolStripButton8";
this.toolStripButton8.RightToLeftAutoMirrorImage = true;
this.toolStripButton8.Size = new System.Drawing.Size(23, 22);
this.toolStripButton8.Text = "Move previous";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
//
// toolStripTextBox1
//
this.toolStripTextBox1.AccessibleName = "Position";
this.toolStripTextBox1.AutoSize = false;
this.toolStripTextBox1.Name = "toolStripTextBox1";
this.toolStripTextBox1.Size = new System.Drawing.Size(50, 23);
this.toolStripTextBox1.Text = "0";
this.toolStripTextBox1.ToolTipText = "Current position";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// toolStripButton9
//
this.toolStripButton9.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton9.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton9.Image")));
this.toolStripButton9.Name = "toolStripButton9";
this.toolStripButton9.RightToLeftAutoMirrorImage = true;
this.toolStripButton9.Size = new System.Drawing.Size(23, 22);
this.toolStripButton9.Text = "Move next";
//
// toolStripButton10
//
this.toolStripButton10.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton10.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton10.Image")));
this.toolStripButton10.Name = "toolStripButton10";
this.toolStripButton10.RightToLeftAutoMirrorImage = true;
this.toolStripButton10.Size = new System.Drawing.Size(23, 22);
this.toolStripButton10.Text = "Move last";
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
//
// toolStripButton11
//
this.toolStripButton11.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton11.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton11.Image")));
this.toolStripButton11.Name = "toolStripButton11";
this.toolStripButton11.RightToLeftAutoMirrorImage = true;
this.toolStripButton11.Size = new System.Drawing.Size(23, 22);
this.toolStripButton11.Text = "Add New";
//
// toolStripLabel2
//
this.toolStripLabel2.Name = "toolStripLabel2";
this.toolStripLabel2.Size = new System.Drawing.Size(27, 22);
this.toolStripLabel2.Text = "/{0}";
this.toolStripLabel2.ToolTipText = "Total items";
//
// toolStripButton12
//
this.toolStripButton12.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton12.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton12.Image")));
this.toolStripButton12.Name = "toolStripButton12";
this.toolStripButton12.RightToLeftAutoMirrorImage = true;
this.toolStripButton12.Size = new System.Drawing.Size(23, 22);
this.toolStripButton12.Text = "Delete";
//
// toolStripButton13
//
this.toolStripButton13.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton13.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton13.Image")));
this.toolStripButton13.Name = "toolStripButton13";
this.toolStripButton13.RightToLeftAutoMirrorImage = true;
this.toolStripButton13.Size = new System.Drawing.Size(23, 22);
this.toolStripButton13.Text = "Move first";
//
// toolStripButton14
//
this.toolStripButton14.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton14.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton14.Image")));
this.toolStripButton14.Name = "toolStripButton14";
this.toolStripButton14.RightToLeftAutoMirrorImage = true;
this.toolStripButton14.Size = new System.Drawing.Size(23, 22);
this.toolStripButton14.Text = "Move previous";
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);
//
// toolStripTextBox2
//
this.toolStripTextBox2.AccessibleName = "Position";
this.toolStripTextBox2.AutoSize = false;
this.toolStripTextBox2.Name = "toolStripTextBox2";
this.toolStripTextBox2.Size = new System.Drawing.Size(50, 23);
this.toolStripTextBox2.Text = "0";
this.toolStripTextBox2.ToolTipText = "Current position";
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25);
//
// toolStripButton15
//
this.toolStripButton15.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton15.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton15.Image")));
this.toolStripButton15.Name = "toolStripButton15";
this.toolStripButton15.RightToLeftAutoMirrorImage = true;
this.toolStripButton15.Size = new System.Drawing.Size(23, 22);
this.toolStripButton15.Text = "Move next";
//
// toolStripButton16
//
this.toolStripButton16.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton16.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton16.Image")));
this.toolStripButton16.Name = "toolStripButton16";
this.toolStripButton16.RightToLeftAutoMirrorImage = true;
this.toolStripButton16.Size = new System.Drawing.Size(23, 22);
this.toolStripButton16.Text = "Move last";
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(6, 25);
//
// errorProvider1
//
this.errorProvider1.ContainerControl = this;
//
// fSetting
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(611, 620);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.panel1);
this.Font = new System.Drawing.Font("맑은 고딕", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "fSetting";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Setting";
this.Load += new System.EventHandler(this.@__Load);
this.panel1.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.PropertyGrid propertyGrid1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.ErrorProvider errorProvider1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.ToolStripButton bindingNavigatorAddNewItem;
private System.Windows.Forms.ToolStripLabel bindingNavigatorCountItem;
private System.Windows.Forms.ToolStripButton bindingNavigatorDeleteItem;
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveFirstItem;
private System.Windows.Forms.ToolStripButton bindingNavigatorMovePreviousItem;
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator;
private System.Windows.Forms.ToolStripTextBox bindingNavigatorPositionItem;
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator1;
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveNextItem;
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveLastItem;
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator2;
private System.Windows.Forms.ToolStripButton toolStripButton5;
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
private System.Windows.Forms.ToolStripButton toolStripButton6;
private System.Windows.Forms.ToolStripButton toolStripButton7;
private System.Windows.Forms.ToolStripButton toolStripButton8;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripTextBox toolStripTextBox1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripButton toolStripButton9;
private System.Windows.Forms.ToolStripButton toolStripButton10;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripButton toolStripButton11;
private System.Windows.Forms.ToolStripLabel toolStripLabel2;
private System.Windows.Forms.ToolStripButton toolStripButton12;
private System.Windows.Forms.ToolStripButton toolStripButton13;
private System.Windows.Forms.ToolStripButton toolStripButton14;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripTextBox toolStripTextBox2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripButton toolStripButton15;
private System.Windows.Forms.ToolStripButton toolStripButton16;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
}
}

View File

@@ -0,0 +1,100 @@
using AR;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Project
{
public partial class fSetting : Form
{
CSetting dummySetting; //Temporarily saves settings and overwrites them when complete.
public fSetting()
{
InitializeComponent();
//setting
dummySetting = new CSetting();
PUB.setting.CopyTo(dummySetting);
this.KeyDown += (s1, e1) =>
{
if (e1.KeyCode == Keys.Escape)
this.Close();
if (DateTime.Now > PUB.LastInputTime) PUB.LastInputTime = DateTime.Now;
};
this.MouseMove += (s1, e1) => { if (DateTime.Now > PUB.LastInputTime) PUB.LastInputTime = DateTime.Now; };
this.FormClosed += __Closed;
}
private void __Closed(object sender, FormClosedEventArgs e)
{
}
private void __Load(object sender, EventArgs e)
{
this.Show();
this.propertyGrid1.SelectedObject = this.dummySetting;
this.propertyGrid1.Refresh();
//if (Pub.setting.Disable_UsingDataMatrix == true) btInspectDotDM.Text = "DOT Inspect";
//else btInspectDotDM.Text = "DM Inspect";
}
private void button1_Click(object sender, EventArgs e)
{
using (var f = new AR.Dialog.fPassword())
if (f.ShowDialog() == DialogResult.OK)
{
var pass = f.tbInput.Text;
if (pass != this.dummySetting.Password_Setup)
{
UTIL.MsgE("Password incorrect");
return;
}
this.Invalidate();
try
{
dummySetting.CopyTo(PUB.setting);
PUB.setting.Save();
PUB.log_[0].AddI("Setting Save");
PUB.log_[0].Add(PUB.setting.ToString());
PUB.log_[1].AddI("Setting Save");
PUB.log_[1].Add(PUB.setting.ToString());
}
catch (Exception ex)
{
PUB.log_[0].AddE("Setting Save Error:" + ex.Message);
PUB.log_[1].AddE("Setting Save Error:" + ex.Message);
UTIL.MsgE("Error\n" + ex.Message + "\n\nPlease try again");
}
//Pub.flag.set(eFlag.TestRun, btLoaderDetect.BackColor == Color.Lime);
DialogResult = DialogResult.OK;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Windows.Forms;
namespace Project
{
public partial class fMain
{
delegate void ShowLotTextHandler(string value);
delegate void UpdateDMTextHandler(string value1);
//void UpdateResultText(string value1)
//{
// if (this.lbResult.InvokeRequired)
// {
// lbResult.BeginInvoke(new UpdateDMTextHandler(UpdateResultText), new object[] { value1 });
// }
// else
// {
// lbResult.Text = value1;
// }
//}
delegate void UpdateLabelTextHandler(Control ctl, string value);
void UpdateLabelText(Control ctl, string value)
{
if (ctl.InvokeRequired)
{
ctl.BeginInvoke(new UpdateLabelTextHandler(UpdateLabelText), new object[] { ctl, value });
}
else
{
ctl.Text = value;
}
}
}
}

View File

@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Project
{
public partial class StateMachine
{
public enum eMsgOpt : byte
{
NORMAL,
STEPCHANGE,
ERROR,
}
/// <summary>
/// 000~020 : System Define
/// 020~255 : User Define
/// </summary>
public enum eSMStep : byte
{
NOTSET = 0,
INIT,
IDLE,
REQSERVM,
REQSERV,
RUN,
/// <summary>
/// 작업완룡
/// </summary>
FINISH,
/// <summary>
/// 왼쪽(출구)에서 자재를 투입합니다
/// </summary>
LTAKE,
/// <summary>
/// 오른쪽(입구)에서 자채를 투입합니다
/// </summary>
//RTAKE,
POSITION_RESET,
PAUSE,
/// <summary>
/// 시작명령을 기다리는중(PAUSE 상태에서 RESET시 설정 됨)
/// </summary>
WAITSTART,
ERROR,
UNLOADER_CHK,
OVERLOAD,
RESET,
SAFTY,
EMERGENCY,
CLEAR,
HOME,
HOMECHK,
QHOME,
CLOSING,
CLOSEWAIT,
CLOSED,
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Project
{
public partial class StateMachine
{
public class StateMachineMessageEventArgs : EventArgs
{
public string Header { get; set; }
public string Message { get; set; }
public StateMachineMessageEventArgs(string header_, string message_)
{
this.Message = message_;
this.Header = header_;
}
}
public event EventHandler<StateMachineMessageEventArgs> Message;
void RaiseMessage(string header, string msg)
{
if (Message != null) Message(this, new StateMachineMessageEventArgs(header, msg));
}
public class StepChangeEventArgs : EventArgs
{
public eSMStep Old { get; set; }
public eSMStep New { get; set; }
public StepChangeEventArgs(eSMStep old_,eSMStep new_)
{
this.Old = old_;
this.New = new_;
}
}
public class RunningEventArgs : EventArgs {
// public object sender { get; set; }
public Boolean isFirst { get; set; }
public eSMStep Step { get; set; }
public TimeSpan StepTime { get; set; }
public RunningEventArgs(eSMStep step_, Boolean isfirst_,TimeSpan steptime_)
{
this.isFirst = isfirst_;
this.Step = step_;
StepTime = steptime_;
// this.sender = sender_;
}
}
//public event EventHandler<StepChangeEventArgs> StepChanged;
//public event EventHandler SPS;
//public event EventHandler<RunningEventArgs> Running;
}
}

View File

@@ -0,0 +1,327 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using WatsonWebsocket;
namespace Project
{
public partial class fMain
{
Byte sendseq = 0;
DateTime[] cameraconntimechk = new DateTime[] { DateTime.Now, DateTime.Now };
private void bwConn_DoWork(object sender, DoWorkEventArgs e)
{
PUB.log_[0].Add("Device connection thread start");
PUB.log_[1].Add("Device connection thread start");
var logIdx = 0;
System.Diagnostics.Stopwatch wat = new System.Diagnostics.Stopwatch();
int idx = 0;
while (bRunConnection && this.IsDisposed == false && this.Disposing == false)
{
//Check listener status
if (idx == 0)
{
//left socket listening
if (PUB.setting.CameraIndexL >= 0)
{
logIdx = 0;
if (PUB.wsock_[logIdx].IsListening == false)
{
var tsli = DateTime.Now - PUB.Time_WS_Listen_Try[PUB.setting.CameraIndexL];
if (tsli.TotalSeconds > 5)
{
//Server retry
PUB.log_[logIdx].AddAT($"Server listen retry port:{PUB.setting.listenPortL}");
try
{
PUB.wsock_[logIdx] = new Class.WebSocket("localhost", PUB.setting.listenPortL);
PUB.wsock_[logIdx].Start();
PUB.wsock_[logIdx].MessageReceived += Ws_DataArrival;
PUB.wsock_[logIdx].ClientConnected += Ws_Connected;
PUB.wsock_[logIdx].ClientDisconnected += Ws_Disconnected;
}
catch (Exception ex)
{
PUB.wsock_[logIdx].MessageReceived -= Ws_DataArrival;
PUB.wsock_[logIdx].ClientConnected -= Ws_Connected;
PUB.wsock_[logIdx].ClientDisconnected -= Ws_Disconnected;
PUB.log_[logIdx].AddE("Server retry listen failed:" + ex.Message);
}
PUB.Time_WS_Listen_Try[PUB.setting.CameraIndexL] = DateTime.Now;
}
}
}
idx += 1;
}
else if (idx == 1)
{
//right socket listening
if (PUB.setting.CameraIndexR >= 0)
{
logIdx = 1;
if (PUB.wsock_[logIdx].IsListening == false)
{
var tsli = DateTime.Now - PUB.Time_WS_Listen_Try[PUB.setting.CameraIndexR];
if (tsli.TotalSeconds > 5)
{
//Server retry
PUB.log_[logIdx].AddAT($"Server listen retry port:{PUB.setting.listenPortR}");
try
{
PUB.wsock_[logIdx] = new Class.WebSocket("localhost", PUB.setting.listenPortR);
PUB.wsock_[logIdx].Start();
PUB.wsock_[logIdx].MessageReceived += Ws_DataArrival;
PUB.wsock_[logIdx].ClientConnected += Ws_Connected;
PUB.wsock_[logIdx].ClientDisconnected += Ws_Disconnected;
}
catch (Exception ex)
{
PUB.wsock_[logIdx].MessageReceived -= Ws_DataArrival;
PUB.wsock_[logIdx].ClientConnected -= Ws_Connected;
PUB.wsock_[logIdx].ClientDisconnected -= Ws_Disconnected;
PUB.log_[logIdx].AddE("Server retry listen failed:" + ex.Message);
}
PUB.Time_WS_Listen_Try[PUB.setting.CameraIndexR] = DateTime.Now;
}
}
}
idx += 1;
}
else if (idx == 2)
{
//Initialization process
try
{
var status = PUB._virtualFG40.InitSystem();
if (status != Crevis.VirtualFG40Library.VirtualFG40Library.MCAM_ERR_SUCCESS)
{
PUB.log_[0].AddE($"Crevis:System Initialize failed : {status}");
PUB.log_[1].AddE($"Crevis:System Initialize failed : {status}");
}
else Console.WriteLine("Camera init ok");
}
catch (Exception ex)
{
Console.WriteLine($"Camera init error {ex.Message}");
}
idx += 1;
}
else if (idx == 3)
{
//open camera
if (camNum > 0 && PUB.setting.CameraIndexL >= 0 && PUB.setting.CameraIndexL < camNum)
{
bool initok = false;
PUB._virtualFG40.IsInitSystem(ref initok);
if (initok)
{
var camIdx = PUB.setting.CameraIndexL;
if (camIdx >= camNum)
{
//Card corresponding to specified index does not exist
}
else if (PUB._hDevice[camIdx] < 0)
{
//Camera index is 0,1 but vision index uses 0,2 as before. 1 is for central Keyence
PUB.log_[logIdx].Add($"Camera {camIdx} connection in progress");
var Piv = camIdx == PUB.setting.CameraIndexL ? this.pivLeft : this.pIvRight;
if (CrevisOpen(camIdx)) PUB.CrevisGrab(camIdx, true, Piv); //Try to capture one image
cameraconntimechk[camIdx] = DateTime.Now;
}
else
{
//Has been connected before.
var ts = DateTime.Now - cameraconntimechk[camIdx];
if (ts.TotalSeconds > 5)
{
bool iscon = false;
var rlt = PUB._virtualFG40.IsOpenDevice(PUB._hDevice[camIdx], ref iscon);
if (rlt == Crevis.VirtualFG40Library.VirtualFG40Library.MCAM_ERR_SUCCESS)
{
var status = PUB._virtualFG40.GetAvailableCameraNum(ref camNum);
if (iscon == false)
{
var Piv = camIdx == PUB.setting.CameraIndexL ? this.pivLeft : this.pIvRight;
if (CrevisOpen(camIdx)) PUB.CrevisGrab(camIdx, true, Piv); //Try to capture one image
}
else
{
//Already connected.
}
}
else if (rlt == Crevis.VirtualFG40Library.VirtualFG40Library.MCAM_ERR_NO_DEVICE)
{
//Device not found, refreshing list.
PUB._virtualFG40.UpdateDevice();
var status = PUB._virtualFG40.GetAvailableCameraNum(ref camNum);
if (camNum <= camIdx)
{
PUB._virtualFG40.FreeSystem();
PUB.log_[logIdx].AddE("The camera can not be connected.");
}
//else
//{
PUB._hDevice[camIdx] = -1; //Induce reconnection work
//}
}
cameraconntimechk[camIdx] = DateTime.Now;
}
}
}
}
//Pub.flag.set(eFlag.CHECKCAMERA, false, "LOAD");
idx += 1;
}
else if (idx == 4)
{
//open camera
bool initok = false;
try
{
PUB._virtualFG40.IsInitSystem(ref initok);
}
catch (Exception ex)
{
Console.WriteLine($"Error _virtualFG40.IsInitSystem : {ex.Message}");
initok = false;
}
if (initok)
{
var camIdx = PUB.setting.CameraIndexR;
if (camIdx >= camNum)
{
//지정한 인덱스에 해당하는 카드가 존재하지 않음
}
else if (camIdx != PUB.setting.CameraIndexL)
{
if (PUB._hDevice[camIdx] < 0)
{
//Camera index is 0,1 but vision index uses 0,2 as before. 1 is for central Keyence
PUB.log_[logIdx].Add($"Camera {camIdx} connection in progress");
var Piv = camIdx == PUB.setting.CameraIndexL ? this.pivLeft : this.pIvRight;
if (CrevisOpen(camIdx)) PUB.CrevisGrab(camIdx, true, Piv); //Try to capture one image
cameraconntimechk[camIdx] = DateTime.Now;
}
else
{
//최소 셋팅된 번호와 현재 카메라 번호가 다르면 초기화를 해준다.
if (FirstCrevisIndex[camIdx] != -1 && FirstCrevisIndex[camIdx] != PUB._hDevice[camIdx])
{
PUB.log_[logIdx].AddE($"Camera Index({camIdx}) error");
PUB._hDevice[camIdx] = -1;
}
else if(PUB._hDevice[0] == PUB._hDevice[1]) //error condition
{
PUB.log_[logIdx].AddE($"Camera Index({camIdx}) error init");
PUB._hDevice[0] = -1;
PUB._hDevice[1] = -1;
FirstCrevisIndex[0] = -1;
FirstCrevisIndex[1] = -1;
}
else
{
//Has been connected before.
var ts = DateTime.Now - cameraconntimechk[camIdx];
if (ts.TotalSeconds > 5)
{
bool iscon = false;
var rlt = PUB._virtualFG40.IsOpenDevice(PUB._hDevice[camIdx], ref iscon);
if (rlt == Crevis.VirtualFG40Library.VirtualFG40Library.MCAM_ERR_SUCCESS)
{
var status = PUB._virtualFG40.GetAvailableCameraNum(ref camNum);
if (iscon == false)
{
var Piv = camIdx == PUB.setting.CameraIndexL ? this.pivLeft : this.pIvRight;
if (CrevisOpen(camIdx)) PUB.CrevisGrab(camIdx, true, Piv); //Try to capture one image
}
else
{
//Already connected.
}
}
else if (rlt == Crevis.VirtualFG40Library.VirtualFG40Library.MCAM_ERR_NO_DEVICE)
{
//Device not found, refreshing list.
PUB._virtualFG40.UpdateDevice();
var status = PUB._virtualFG40.GetAvailableCameraNum(ref camNum);
if (camNum <= camIdx)
{
PUB._virtualFG40.FreeSystem();
PUB.log_[logIdx].AddE("The camera can not be connected.");
}
//else
//{
PUB._hDevice[camIdx] = -1; //Induce reconnection work
//}
}
cameraconntimechk[camIdx] = DateTime.Now;
}
}
}
}
}
// panMiniDisplay.Invalidate();
//Pub.flag.set(eFlag.CHECKCAMERA, false, "LOAD");
idx += 1;
}
else
{
idx = 0;
}
if (sendseq == 0)
{
if (PUB.setting.CameraIndexL >= 0)
SendStatus(eTarget.Left);
sendseq += 1;
}
else if (sendseq == 1)
{
if (PUB.setting.CameraIndexR >= 0 && PUB.setting.CameraIndexR != PUB.setting.CameraIndexL)
SendStatus(eTarget.Right);
sendseq += 1;
}
else sendseq = 0;
if (idx > 4) idx = 0;
//heartbeat
if (this.IsDisposed == false)
{
this.Invoke(new Action(() =>
{
try
{
if (this.sbConnState.ForeColor == Color.LimeGreen)
this.sbConnState.ForeColor = Color.Green;
else
this.sbConnState.ForeColor = Color.LimeGreen;
}
catch { }
}));
}
System.Threading.Thread.Sleep(250);
}
}
}
}

View File

@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using WatsonWebsocket;
namespace Project
{
public partial class fMain
{
private void bwLeft_DoWork(object sender, DoWorkEventArgs e)
{
var camIdx = PUB.setting.CameraIndexL;
var logIdx = 0;
PUB.log_[logIdx].Add("Camera thread(L) start");
System.Diagnostics.Stopwatch wat = new System.Diagnostics.Stopwatch();
var framedelay = (int)(1000f / 12f);//Time required to get 1 frame 12f / 1000;
while (bRunConnection && this.IsDisposed == false && this.Disposing == false)
{
wat.Restart();
var _fpsms = framedelay;// IsTrigger ? Pub.setting.GrabDelayFast : Pub.setting.GrabDelaySlow;
if (PUB.imgque == null || PUB.imgque.Any() == false) continue;
if (PUB.imgque.Peek().Equals(this.Name) == false) continue;
if (camIdx < 0)
{
this.BeginInvoke(new Action(() =>
{
sbConnCamL.ForeColor = Color.Red;
}));
System.Threading.Thread.Sleep(1000);
continue;
}
//If camera is not connected, do not process.
if (PUB._isCrevisOpen[camIdx] == false || PUB.IsLive[camIdx] == false || PUB.flag.get(eFlag.CAMERAINIT) == false) _fpsms = 1000;
else
{
//Data processing after image acquisition
var Piv = camIdx == PUB.setting.CameraIndexL ? this.pivLeft : this.pIvRight;
if (PUB.CrevisGrab(camIdx, true, Piv))
{
if (PUB.IsProcess[camIdx] || PUB.IsTrigger[camIdx])
PUB.CreavisProcess(camIdx, PUB.IsTrigger[camIdx], Piv);
}
//this.BeginInvoke(new Action(() => {
// //Update current time
// if (iv[camIdx] != null)
// {
// if (iv[camIdx].Shapes.Count < 1)
// iv[camIdx].Shapes.AddText(100, 100, DateTime.Now.ToShortTimeString(), Color.Lime, 100);
// else
// iv[camIdx].Shapes[0].Title = DateTime.Now.ToShortTimeString();
// iv[camIdx].Invalidate();
// }
//}));
if (PUB.IsTrigger[camIdx] && PUB.setting.TriggerTimeout > 0 && PUB.setting.TriggerTimeout < 999)
{
var ts = DateTime.Now - PUB.triggerTime[camIdx];
if (ts.TotalSeconds > PUB.setting.TriggerTimeout)
{
PUB.log_[logIdx].Add($"Trigger maximum time({PUB.setting.TriggerTimeout}) exceeded, releasing");
PUB.IsTrigger[camIdx] = false;
PUB.IsLive[camIdx] = false;
PUB.IsProcess[camIdx] = false;
}
}
}
wat.Stop();
if (wat.ElapsedMilliseconds < _fpsms)
{
try
{
if (PUB.setting.AutoDeleteSeconds > 0 && PUB.setting.AutoDeleteSeconds < 99)
{
var di = new System.IO.DirectoryInfo(PUB.setting.ImageSavePath);
var ttime = DateTime.Now.AddSeconds(-PUB.setting.AutoDeleteSeconds);
var dellist = di.GetFiles().Where(t => t.CreationTime <= ttime).FirstOrDefault();
if (dellist != null) dellist.Delete();
}
}
catch { }
System.Threading.Thread.Sleep(_fpsms - (int)wat.ElapsedMilliseconds);
}
//heart beat
this.BeginInvoke(new Action(() =>
{
if (sbConnCamL.ForeColor == Color.Green)
sbConnCamL.ForeColor = Color.LimeGreen;
else
sbConnCamL.ForeColor = Color.Green;
}));
}
}
}
}

View File

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using WatsonWebsocket;
namespace Project
{
public partial class fMain
{
private void bwRight_DoWork(object sender, DoWorkEventArgs e)
{
var camIdx = PUB.setting.CameraIndexR;
var logIdx = 1;
PUB.log_[logIdx].Add("Camera thread(R) start");
System.Diagnostics.Stopwatch wat = new System.Diagnostics.Stopwatch();
var framedelay = (int)(1000f / 12f);//Time required to get 1 frame 12f / 1000;
while (bRunConnection && this.IsDisposed == false && this.Disposing == false)
{
wat.Restart();
var _fpsms = framedelay;// IsTrigger ? Pub.setting.GrabDelayFast : Pub.setting.GrabDelaySlow;
if (PUB.imgque == null || PUB.imgque.Any() == false) continue;
if (PUB.imgque.Peek().Equals(this.Name) == false) continue;
if (camIdx < 0 || PUB.setting.CameraIndexL == PUB.setting.CameraIndexR)
{
this.BeginInvoke(new Action(() =>
{
sbConnCamR.ForeColor = Color.Red;
}));
System.Threading.Thread.Sleep(1000);
continue;
}
//If camera is not connected, do not process.
if (PUB._isCrevisOpen[camIdx] == false || PUB.IsLive[camIdx] == false || PUB.flag.get(eFlag.CAMERAINIT) == false) _fpsms = 1000;
else
{
//Data processing after image acquisition
var Piv = this.pIvRight;
if (PUB.CrevisGrab(camIdx, true, Piv))
{
if (PUB.IsProcess[camIdx])
PUB.CreavisProcess(camIdx, PUB.IsTrigger[camIdx], Piv);
}
if (PUB.setting.TriggerTimeout > 0 && PUB.setting.TriggerTimeout < 999)
{
var ts = DateTime.Now - PUB.triggerTime[camIdx];
if (PUB.IsTrigger[camIdx] && ts.TotalSeconds > PUB.setting.TriggerTimeout)
{
PUB.log_[logIdx].Add($"Trigger maximum time({PUB.setting.TriggerTimeout}) exceeded, releasing");
PUB.IsTrigger[camIdx] = false;
}
}
}
wat.Stop();
if (wat.ElapsedMilliseconds < _fpsms)
{
try
{
if (PUB.setting.AutoDeleteSeconds > 0 && PUB.setting.AutoDeleteSeconds < 99)
{
var di = new System.IO.DirectoryInfo(PUB.setting.ImageSavePath);
var ttime = DateTime.Now.AddSeconds(-PUB.setting.AutoDeleteSeconds);
var dellist = di.GetFiles().Where(t => t.CreationTime <= ttime).FirstOrDefault();
if (dellist != null) dellist.Delete();
}
}
catch { }
System.Threading.Thread.Sleep(_fpsms - (int)wat.ElapsedMilliseconds);
}
//heart beat
this.BeginInvoke(new Action(() =>
{
if (sbConnCamR.ForeColor == Color.Green)
sbConnCamR.ForeColor = Color.LimeGreen;
else
sbConnCamR.ForeColor = Color.Green;
}));
}
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace Project
{
public partial class fMain
{
/// <summary>
/// Function executed once when closing the program
/// </summary>
private void _Close_Start()
{
//동작코드off
PUB.IsTrigger[0] = PUB.IsTrigger[1] = false;
PUB.IsProcess[0] = PUB.IsProcess[1] = false;
PUB.IsLive[0] = PUB.IsLive[1] = false;
tmDisplay.Stop();
PUB.log_[0].Add("Socket close");
PUB.log_[1].Add("Socket close");
try
{
PUB.wsock_[0].Stop();
PUB.wsock_[1].Stop();
}
catch { }
//연결체크용 쓰레드 종료
bRunConnection = false;
PUB.log_[0].Add("Program Close");
PUB.log_[1].Add("Program Close");
PUB.LogFlush();
//크레비스OFF - 210203
try
{
if (PUB._hDevice[PUB.setting.CameraIndexL] > 0)
PUB._virtualFG40.AcqStop(PUB._hDevice[PUB.setting.CameraIndexL]);
if (PUB._hDevice[PUB.setting.CameraIndexR] > 0)
PUB._virtualFG40.AcqStop(PUB._hDevice[PUB.setting.CameraIndexR]);
PUB._virtualFG40.FreeSystem();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}

View File

@@ -0,0 +1,258 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Crevis.VirtualFG40Library;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
#if V22
using Euresys.Open_eVision_22_12;
using Euresys.Open_eVision_22_12.Easy3D;
#else
using Euresys.Open_eVision_2_11;
#endif
namespace Project
{
public partial class fMain
{
UInt32 camNum = 0;
/// <summary>
/// Crevis must be initialized in the main thread
/// </summary>
void _SM_RUN_INIT_CAMERA()
{
//Crevis Init
PUB._virtualFG40 = new VirtualFG40Library();
Int32 status = VirtualFG40Library.MCAM_ERR_SUCCESS;
try
{
//System InitializSend_WSocke
status = PUB._virtualFG40.InitSystem();
if (status != VirtualFG40Library.MCAM_ERR_SUCCESS)
{
PUB.log_[0].AddE($"Crevis:System Initialize failed : {status}");
PUB.log_[1].AddE($"Crevis:System Initialize failed : {status}");
}
else
{
// Update Device List
//status = _virtualFG40.UpdateDevice();
//if (status != VirtualFG40Library.MCAM_ERR_SUCCESS)
//{
// _virtualFG40.FreeSystem();
// throw new Exception(String.Format("Update Device list failed : {0}", status));
//}
status = PUB._virtualFG40.GetAvailableCameraNum(ref camNum);
if (camNum <= 0)
{
PUB._virtualFG40.FreeSystem();
PUB.log_[0].AddE("The camera can not be connected.");
PUB.log_[1].AddE("The camera can not be connected.");
}
else Console.WriteLine($"Camera {camNum} Found");
//camNum = 1;
}
//if (camNum > 0)
//{
// //카메라 인덱스는 0,1 이지만 비젼인덱스는 기존대로 0,2번을 사용한다. 1번은 중앙 키엔스용이다
// Pub.log.Add($"{Pub.setting.CameraIndex}번 카메라 연결 진행");
// if (CrevisOpen(Pub.setting.CameraIndex)) CrevisGrab(true); //한장을 수집해본다
//}
}
catch (Exception ex)
{
PUB.log_[0].AddE("Crevis:" + ex.Message);
PUB.log_[1].AddE("Crevis:" + ex.Message);
}
}
int[] FirstCrevisIndex = new int[] { -1, -1 };
/// <summary>
/// Camera open
/// </summary>
/// <param name="camIdx"></param>
/// <returns></returns>
Boolean CrevisOpen(int camIdx)
{
Int32 status = VirtualFG40Library.MCAM_ERR_SUCCESS;
var logIdx = camIdx == PUB.setting.CameraIndexL ? 0 : 1;
try
{
// camera open
status = PUB._virtualFG40.OpenDevice((uint)camIdx, ref PUB._hDevice[camIdx]);
if (status != VirtualFG40Library.MCAM_ERR_SUCCESS)
{
PUB._virtualFG40.FreeSystem();
PUB.log_[logIdx].AddE($"Open device failed : {status}");
PUB._isCrevisOpen[camIdx] = false;
return false;
}
if (FirstCrevisIndex[camIdx] == -1)
FirstCrevisIndex[camIdx] = PUB._hDevice[camIdx];
PUB._isCrevisOpen[camIdx] = true;
// Call Set Feature
CrevisSetFeature((uint)camIdx);
// Get Width
status = PUB._virtualFG40.GetIntReg(PUB._hDevice[camIdx], VirtualFG40Library.MCAM_WIDTH, ref PUB._width[camIdx]);
if (status != VirtualFG40Library.MCAM_ERR_SUCCESS)
{
throw new Exception(String.Format("Read Register MCAM_WIDTH failed : {0}", status));
}
// Get Height
status = PUB._virtualFG40.GetIntReg(PUB._hDevice[camIdx], VirtualFG40Library.MCAM_HEIGHT, ref PUB._height[camIdx]);
if (status != VirtualFG40Library.MCAM_ERR_SUCCESS)
{
throw new Exception(String.Format("Read Register MCAM_HEIGHT failed : {0}", status));
}
// Get FPS
//status = _virtualFG40.GetIntReg(_hDevice, VirtualFG40Library.MCAM_ACQUISITION_FRAME_COUNT, ref _fps);
//if (status != VirtualFG40Library.MCAM_ERR_SUCCESS)
//{
// throw new Exception(String.Format("Read Register MCAM_ACQUISITION_FRAME_COUNT failed : {0}", status));
//}
PUB.log_[logIdx].AddI($"Camera({camIdx}) connection complete({PUB._width[camIdx]}x{PUB._height[camIdx]})");
uint grabtimeout = 0;
status = PUB._virtualFG40.GetGrabTimeout(PUB._hDevice[camIdx], ref grabtimeout);
if (status != VirtualFG40Library.MCAM_ERR_SUCCESS)
{
throw new Exception(String.Format("Read TimeOut failed : {0}", status));
}
else PUB._virtualFG40.SetGrabTimeout(PUB._hDevice[camIdx], 1000); //타임아웃 1초로 지정(기본값:5초) 210113
// Image buffer allocation
PUB._bufferSize[camIdx] = PUB._width[camIdx] * PUB._height[camIdx];
PUB.camPtr[camIdx] = Marshal.AllocHGlobal(PUB._bufferSize[camIdx]);
//데이터를 받을 저장소 초기화(흑백)
var bitsPerPixel = 8;
PUB._stride[camIdx] = (Int32)((PUB._width[camIdx] * bitsPerPixel + 7) / 8);
//var imgRect = new Rectangle(0, 0, _width[camIdx], _height[camIdx]);
//OrgBitmap = new Bitmap(_width, _height, _stride, PixelFormat.Format8bppIndexed, _pImage);
// SetGrayscalePalette(OrgBitmap);
//오픈이비젼은 사용가능하면 처리한다
//if (OrgEImage[camIdx] != null) OrgEImage[camIdx].Dispose();
//OrgEImage[camIdx] = new EImageBW8();
//OrgEImage[camIdx].SetImagePtr(_width[camIdx], _height[camIdx], pImage);
//openCv 이미지 처리
// OrgImage = new Image<Gray, byte>(_width, _height, _stride, _pImage);
//OrgCImage = new Image<Bgr, byte>(_width, _height, new Bgr(Color.Black));
//데이터를 표시할 저장소 초기화 (컬러)
//OrgBitmapC = new Bitmap(_width, _height, PixelFormat.Format24bppRgb);
//var lockColor = OrgBitmapC.LockBits(imgRect, ImageLockMode.ReadOnly, OrgBitmapC.PixelFormat);
//OrgImageC = new Image<Bgr, byte>(_width, _height, lockColor.Stride, lockColor.Scan0);
//OrgBitmapC.UnlockBits(lockColor);
}
catch (Exception ex)
{
PUB._isCrevisOpen[camIdx] = false;
MakeBlankImage(camIdx, "ERROR"); //빈 이미지 설정
PUB.log_[logIdx].AddE("Crevis Error:" + ex.Message);// MessageBox.Show(ex.Message);
}
PUB.flag.set(eFlag.CAMERAINIT, PUB._isCrevisOpen[camIdx], "");
//이미지를 화면에 표시한다.
//ivL.Image = OrgEImage; ivL.ZoomFit();
return PUB._isCrevisOpen[camIdx];
}
void MakeBlankImage(int camIdx, string title = "")
{
PUB._width[camIdx] = 1024;
PUB._height[camIdx] = 768;
if (PUB.mre[camIdx].WaitOne(100))
{
PUB.mre[camIdx].Reset();
PUB.OrgImage[camIdx] = new EImageBW8();
PUB.OrgImage[camIdx].SetSize(PUB._width[camIdx], PUB._height[camIdx]);
PUB.mre[camIdx].Set();
}
}
private void CrevisSetFeature(uint camIdx)
{
Int32 status = VirtualFG40Library.MCAM_ERR_SUCCESS;
var logIdx = camIdx == PUB.setting.CameraIndexL ? 0 : 1;
try
{
// Set Trigger Mode
status = PUB._virtualFG40.SetEnumReg(PUB._hDevice[camIdx], VirtualFG40Library.MCAM_TRIGGER_MODE, VirtualFG40Library.TRIGGER_MODE_OFF);
if (status != VirtualFG40Library.MCAM_ERR_SUCCESS)
{
throw new Exception(String.Format("Write Register failed : {0}", status));
}
// Set PixelFormat
status = PUB._virtualFG40.SetEnumReg(PUB._hDevice[camIdx], VirtualFG40Library.MCAM_PIXEL_FORMAT, VirtualFG40Library.PIXEL_FORMAT_MONO8);
if (status != VirtualFG40Library.MCAM_ERR_SUCCESS)
{
throw new Exception(String.Format("Write Register failed : {0}", status));
}
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
PUB.log_[logIdx].AddE(ex.Message);
}
}
//private void SetGrayscalePalette(Bitmap bitmap)
//{
// ColorPalette GrayscalePalette = bitmap.Palette;
// for (int i = 0; i < 255; i++)
// {
// GrayscalePalette.Entries[i] = Color.FromArgb(i, i, i);
// }
// bitmap.Palette = GrayscalePalette;
//}
}
}

View File

@@ -0,0 +1,177 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using WatsonWebsocket;
namespace Project
{
public partial class fMain
{
public object listlock = new object();
public List<string> ClientList = new List<string>();
private void Ws_Disconnected(object sender, ClientDisconnectedEventArgs e)
{
var ws = sender as Class.WebSocket;
var ip = e.IpPort;
var logIdx = ws.Target == eTarget.Left ? 0 : 1;
PUB.Time_WS_Disconnected[ws.TargetIdx] = DateTime.Now;
PUB.log_[logIdx].AddAT("Host connection terminated");
lock (ClientList)
{
if (ClientList.Contains(ip))
ClientList.Remove(ip);
}
}
private void Ws_Connected(object sender, ClientConnectedEventArgs e)
{
var ws = sender as Class.WebSocket;
var logIdx = ws.Target == eTarget.Left ? 0 : 1;
PUB.Time_WS_Connected[ws.TargetIdx] = DateTime.Now;
PUB.log_[logIdx].AddAT("Host connection completed");
lock (ClientList)
{
if (ClientList.Contains(e.IpPort))
ClientList.Add(e.IpPort);
}
}
void SendStatus(eTarget cam)
{
var camIdx = cam == eTarget.Left ? PUB.setting.CameraIndexL : PUB.setting.CameraIndexR;
var logIdx = cam == eTarget.Left ? 0 : 1;
var camTarget = PUB.GetTarget(camIdx);
if (camTarget == eTarget.None) return;
//데이터 생성
var msg = new
{
command = "status",
camera = PUB._isCrevisOpen[camIdx] ? "1" : "0",
live = PUB.IsLive[camIdx] ? "1" : "0",
stream = PUB.setting.DisableStreamData ? "0" : "1",
listen = PUB.wsock_[logIdx].IsListening ? "1" : "0",
trig = PUB.IsTrigger[camIdx] ? "1" : "0",
license = PUB.VisionLicense ? "1" : "0",
reel = PUB.DetectReel[camIdx] ? "1" : "0",
conv = "0",
};
var json = Newtonsoft.Json.JsonConvert.SerializeObject(msg);
try
{
//PUB.log_[logIdx].Add("상태전송:" + msg);
PUB.lastsendStatus[camIdx] = DateTime.Now;
PUB.Send_WSock(camTarget, json);
//PUB.ws[camIdx].ListClients().ToList().ForEach(t => PUB.ws[camIdx].SendAsync(t, json).Wait());
}
catch (Exception ex)
{
PUB.log_[logIdx].AddE($"(STATUS) send failed {ex.Message}");
}
}
private void Ws_DataArrival(object sender, MessageReceivedEventArgs e)
{
var ws = sender as Class.WebSocket;
var ip = e.IpPort;
var raw = Encoding.UTF8.GetString(e.Data);
var logIdx = ws.Target == eTarget.Left ? 0 : 1;
var camIdx = ws.TargetIdx;
var camTarget = PUB.GetTarget(camIdx);
PUB.log_[logIdx].Add($"Received:{raw}");
PUB.Time_WS_Recv[camIdx] = DateTime.Now;
var jvalue = JObject.Parse(raw);
//데이터 생성
var msg = new
{
guid = jvalue.Value<String>("guid"),
command = jvalue.Value<String>("command"),
data = jvalue.Value<String>("data")
};
if (msg.command == "ON" || msg.command == "BCDIN")
{
PUB.RequestNewRead = true;
PUB.triggerTime[ws.TargetIdx] = DateTime.Now;
PUB.lastguid[ws.TargetIdx] = msg.guid;
PUB.lastcmd[ws.TargetIdx] = msg.command;
PUB.lastdata[ws.TargetIdx] = msg.data;
PUB.lastip[ws.TargetIdx] = e.IpPort;
if (string.IsNullOrEmpty(PUB.lastlogbarcode)) PUB.lastlogbarcode = string.Empty;
PUB.IsTrigger[ws.TargetIdx] = true;
PUB.TriggerStart = DateTime.Now;
PUB.log_[logIdx].Add("Clearing existing data due to barcode GUID reception, value=" + PUB.lastlogbarcode);
PUB.lastlogbarcode = string.Empty; //211206
PUB.parsetime = DateTime.Now;
}
else if (msg.command == "TRIG")
{
PUB.RequestNewRead = true;
PUB.triggerTime[ws.TargetIdx] = DateTime.Now;
PUB.lastguid[ws.TargetIdx] = msg.guid;
PUB.lastcmd[ws.TargetIdx] = msg.command;
PUB.lastdata[ws.TargetIdx] = msg.data;
PUB.lastip[ws.TargetIdx] = e.IpPort;
if (string.IsNullOrEmpty(PUB.lastlogbarcode)) PUB.lastlogbarcode = string.Empty;
PUB.IsTrigger[ws.TargetIdx] = true;
PUB.TriggerStart = DateTime.Now;
PUB.log_[logIdx].Add("Clearing existing data due to barcode GUID reception, value=" + PUB.lastlogbarcode);
PUB.lastlogbarcode = string.Empty; //211206
PUB.parsetime = DateTime.Now;
PUB.IsLive[ws.TargetIdx] = true;
PUB.IsProcess[ws.TargetIdx] = true;
}
else if (msg.command == "LIVEON")
{
PUB.IsLive[ws.TargetIdx] = true;
PUB.log_[logIdx].Add("live on received");
}
else if (msg.command == "LIVEOFF")
{
PUB.IsLive[ws.TargetIdx] = false;
PUB.log_[logIdx].Add("live off received");
}
else if (msg.command == "STREAMOFF")
{
PUB.setting.DisableStreamData = true;
PUB.setting.Save();
}
else if (msg.command == "STREAMON")
{
PUB.setting.DisableStreamData = false;
PUB.setting.Save();
}
else if (msg.command == "OFF")
{
PUB.IsTrigger[ws.TargetIdx] = false;
PUB.log_[logIdx].Add("OFF 수신으로 트리거상태를 해제 합니다");
PUB.IsLive[ws.TargetIdx] = false;
PUB.IsProcess[ws.TargetIdx] = false;
}
else if (msg.command == "STATUS")
{
//나의 상태값을 전송 해야한다
SendStatus(camTarget);
}
else
{
PUB.log_[logIdx].AddAT($"Unknown command({msg.command})");
}
}
}
}

View File

@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using WatsonWebsocket;
namespace Project
{
public partial class fMain
{
DateTime tm1minute = DateTime.Now.AddDays(-1);
DateTime tm5minute = DateTime.Now;
Boolean displayOn = false;
DateTime tmPaint = DateTime.Now;
private void tmDisplay_Tick(object sender, EventArgs e)
{
if (displayOn == false) displayOn = true;
else
{
//Pub.log.AddAT("Display Timer Overlab");// Console.WriteLine("display overlab");
return;
}
//메인화면3초에 한번씩 업데이트한다
var tsPaint = DateTime.Now - tmPaint;
if (tsPaint.TotalSeconds > 3)
{
//panMiniDisplay.Invalidate();
tmPaint = DateTime.Now;
}
//트리거버튼
btTrigL.BackColor = PUB.IsTrigger[PUB.setting.CameraIndexL] ? Color.Lime : SystemColors.Control;
btTrigR.BackColor = PUB.IsTrigger[PUB.setting.CameraIndexR] ? Color.Lime : SystemColors.Control;
//라이브상태표시
if (PUB.setting.CameraIndexL >= 0)
btLiveL.BackColor = PUB.IsLive[PUB.setting.CameraIndexL] ? Color.Lime : SystemColors.Control;
else btLiveL.BackColor = SystemColors.Control;
if (PUB.setting.CameraIndexR >= 0 && PUB.setting.CameraIndexR != PUB.setting.CameraIndexL)
btLiveR.BackColor = PUB.IsLive[PUB.setting.CameraIndexR] ? Color.Lime : SystemColors.Control;
else btLiveR.BackColor = SystemColors.Control;
//프로세스버튼
btProcessL.BackColor = PUB.IsProcess[PUB.setting.CameraIndexL] ? Color.Lime : SystemColors.Control;
btProcessR.BackColor = PUB.IsProcess[PUB.setting.CameraIndexR] ? Color.Lime : SystemColors.Control;
//데이터정보
lbGuidL.Text = $"GUID : {PUB.lastguid[PUB.setting.CameraIndexL]}";
lbGuidR.Text = $"GUID : {PUB.lastguid[PUB.setting.CameraIndexR]}";
lbTimeL.Text = $"TIME : " + PUB.Time_WS_Recv[PUB.setting.CameraIndexL].ToString("yyyy-MM-dd HH:mm:ss.fff");
lbTimeR.Text = $"TIME : " + PUB.Time_WS_Recv[PUB.setting.CameraIndexR].ToString("yyyy-MM-dd HH:mm:ss.fff");
lbDataL.Text = $"DATA : " + PUB.lastdata[PUB.setting.CameraIndexL];
lbDataR.Text = $"DATA : " + PUB.lastdata[PUB.setting.CameraIndexR];
lbproctimel.Text = $"(Analysis {PUB.ProcessTime[PUB.setting.CameraIndexL]}ms)";
lbproctimer.Text = $"(Analysis {PUB.ProcessTime[PUB.setting.CameraIndexR]}ms)";
label1.Text = $"STAT: {PUB.lastsendStatus[PUB.setting.CameraIndexL].ToString("HH:mm:ss.fff")}";
label8.Text = $"STAT : {PUB.lastsendStatus[PUB.setting.CameraIndexR].ToString("HH:mm:ss.fff")}";
label2.Text = $"SEND: {PUB.lastsend[PUB.setting.CameraIndexL].ToString("HH:mm:ss.fff")}";
label9.Text = $"SEND : {PUB.lastsend[PUB.setting.CameraIndexR].ToString("HH:mm:ss.fff")}";
//sbMemMapL.ForeColor = swplc[PUB.setting.CameraIndexL].Init ? Color.Lime : Color.Red;
//sbMemMapR.ForeColor = swplc[PUB.setting.CameraIndexR].Init ? Color.Lime : Color.Red;
if (PUB.setting.CameraIndexL >= 0)
{
sbConnCamL.ForeColor = PUB._isCrevisOpen[PUB.setting.CameraIndexL] ? Color.Green : Color.Red;
sbLiveL.ForeColor = PUB.IsLive[PUB.setting.CameraIndexL] ? Color.Green : Color.Red;
sbDetectReelL.ForeColor = PUB.DetectReel[PUB.setting.CameraIndexL] ? Color.Lime : Color.Black;
sbDetectCVL.ForeColor = PUB.DetectConv[PUB.setting.CameraIndexL] ? Color.Lime : Color.Black;
sbTrigL.ForeColor = PUB.IsTrigger[PUB.setting.CameraIndexL] ? Color.Green : Color.Red;
}
else
{
var c = Color.DimGray;
sbConnCamL.ForeColor =c;
sbLiveL.ForeColor =c;
sbDetectReelL.ForeColor =c;
sbDetectCVL.ForeColor =c;
sbTrigL.ForeColor = c;
}
if (PUB.setting.CameraIndexR >= 0)
{
sbConnCamR.ForeColor = PUB._isCrevisOpen[PUB.setting.CameraIndexR] ? Color.Green : Color.Red;
sbLiveR.ForeColor = PUB.IsLive[PUB.setting.CameraIndexR] ? Color.Green : Color.Red;
sbDetectReelR.ForeColor = PUB.DetectReel[PUB.setting.CameraIndexR] ? Color.Lime : Color.Black;
sbDetectCVR.ForeColor = PUB.DetectConv[PUB.setting.CameraIndexR] ? Color.Lime : Color.Black;
sbTrigR.ForeColor = PUB.IsTrigger[PUB.setting.CameraIndexR] ? Color.Green : Color.Red;
}
else
{
var c = Color.DimGray;
sbConnCamR.ForeColor = c;
sbLiveR.ForeColor = c;
sbDetectReelR.ForeColor = c;
sbDetectCVR.ForeColor = c;
sbTrigR.ForeColor = c;
}
sbConnHostL.ForeColor = PUB.wsock_[0].ListClients().Count() > 0 ? Color.Green : Color.Red;
sbConnHostR.ForeColor = PUB.wsock_[1].ListClients().Count() > 0 ? Color.Green : Color.Red;
sbStream.ForeColor = PUB.setting.DisableStreamData ? Color.Red : Color.Green;
sbListenL.ForeColor = PUB.wsock_[0].IsListening ? Color.Green : Color.Red;
sbListenR.ForeColor = PUB.wsock_[1].IsListening ? Color.Green : Color.Red;
sbLicense.ForeColor = PUB.VisionLicense ? Color.Green : Color.Red;
#region retgion"1분 time 루틴"
var ts = DateTime.Now - tm1minute;
if (ts.TotalMinutes >= 1)
{
//리셋카운트
tm1minute = DateTime.Now;
}
#endregion
#region retgion"5분 time 루틴"
ts = DateTime.Now - tm5minute;
if (ts.TotalMinutes >= 5)
{
//남은디스크확인
tm5minute = DateTime.Now;
}
#endregion
//wat.Stop();
//Console.WriteLine("disp time : " + wat.ElapsedMilliseconds.ToString() + "ms");
displayOn = false;
}
}
}

View File

@@ -0,0 +1,301 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Windows.Forms;
using System.Data;
using AR;
namespace Project
{
public static class Util
{
public static void SaveBugReport(string content, string subdirName = "BugReport")
{
try
{
var path = CurrentPath + subdirName;
if (!System.IO.Directory.Exists(path)) System.IO.Directory.CreateDirectory(path);
var file = path + "\\" + DateTime.Now.ToString("yyyyMMdd_HHmmss_fff") + ".txt";
System.IO.File.WriteAllText(file, content, System.Text.Encoding.UTF8);
}
catch
{
//nothing
}
}
/// <summary>
/// Returns the currently executing folder.
/// </summary>
public static string CurrentPath
{
get
{
return AppDomain.CurrentDomain.BaseDirectory;
}
}
#region "convert"
public static string RectToStr(Rectangle rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
}
public static string RectToStr(RectangleF rect)
{
return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
}
public static string PointToStr(Point pt)
{
return string.Format("{0};{1}", pt.X, pt.Y);
}
public static string PointToStr(PointF pt)
{
return string.Format("{0};{1}", pt.X, pt.Y);
}
public static Rectangle StrToRect(string str)
{
if (str.isEmpty() || str.Split(';').Length != 4) str = "0;0;0;0";
var roibuf1 = str.Split(';');
return new System.Drawing.Rectangle(
int.Parse(roibuf1[0]),
int.Parse(roibuf1[1]),
int.Parse(roibuf1[2]),
int.Parse(roibuf1[3]));
}
public static RectangleF StrToRectF(string str)
{
if (str.isEmpty() || str.Split(';').Length != 4) str = "0;0;0;0";
var roibuf1 = str.Split(';');
return new System.Drawing.RectangleF(
float.Parse(roibuf1[0]),
float.Parse(roibuf1[1]),
float.Parse(roibuf1[2]),
float.Parse(roibuf1[3]));
}
public static Point StrToPoint(string str)
{
if (str.isEmpty() || str.Split(';').Length != 2) str = "0;0";
var roibuf1 = str.Split(';');
return new System.Drawing.Point(
int.Parse(roibuf1[0]),
int.Parse(roibuf1[1]));
}
public static PointF StrToPointF(string str)
{
if (str.isEmpty() || str.Split(';').Length != 2) str = "0;0";
var roibuf1 = str.Split(';');
return new System.Drawing.PointF(
float.Parse(roibuf1[0]),
float.Parse(roibuf1[1]));
}
#endregion
#region "NIC"
/// <summary>
/// Checks if the specified NIC card exists in the current list.
/// </summary>
/// <returns></returns>
public static Boolean ExistNIC(string NICName)
{
if (string.IsNullOrEmpty(NICName)) return false;
foreach (string NetName in NICCardList())
{
if (NetName.ToLower() == NICName.ToLower())
{
return true;
}
}
return false;
}
/// <summary>
/// Sets the Ethernet Card to disabled. (Administrator privileges required)
/// </summary>
/// <param name="NicName"></param>
public static Boolean NICDisable(string NICName)
{
//해당 nic 가 현재 목록에 존재하는지 확인한다.
string cmd = "interface set interface " + NICName + " disable";
Process prc = new Process();
ProcessStartInfo si = new ProcessStartInfo("netsh", cmd);
si.WindowStyle = ProcessWindowStyle.Hidden;
prc.StartInfo = si;
prc.Start();
////목록에서 사라질때까지 기다린다.
DateTime SD = DateTime.Now;
Boolean timeout = false;
while ((true))
{
bool FindNetwork = false;
foreach (string NetName in NICCardList())
{
if (NetName == NICName.ToLower())
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
if (!FindNetwork)
break; // TODO: might not be correct. Was : Exit While
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
timeout = true;
break; // TODO: might not be correct. Was : Exit While
}
}
return !timeout;
}
public static List<String> NICCardList()
{
List<String> Retval = new List<string>();
foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
{
if (Net.NetworkInterfaceType == System.Net.NetworkInformation.NetworkInterfaceType.Ethernet)
{
Retval.Add(Net.Name.ToUpper());
}
}
return Retval;
}
/// <summary>
/// Sets the Ethernet card to enabled.
/// </summary>
/// <param name="NicName"></param>
public static Boolean NICEnable(string NICName)
{
string cmd = "interface set interface " + NICName + " enable";
System.Diagnostics.Process prc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo("netsh", cmd);
si.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
prc.StartInfo = si;
prc.Start();
////목록에생길떄까지 대기
DateTime SD = DateTime.Now;
while ((true))
{
bool FindNetwork = false;
foreach (string NetName in NICCardList())
{
if (NetName.ToLower() == NICName.ToLower())
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
if (FindNetwork)
break; // TODO: might not be correct. Was : Exit While
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
return false;
}
}
////결이 완료될떄까지 기다린다.
SD = DateTime.Now;
while ((true))
{
bool FindNetwork = false;
foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
{
if (Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.GigabitEthernet &&
Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Ethernet) continue;
if (Net.Name.ToLower() == NICName.ToLower())
{
//string data = Net.GetIPProperties().GatewayAddresses[0].ToString();
if (Net.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
{
FindNetwork = true;
break; // TODO: might not be correct. Was : Exit For
}
}
}
if (FindNetwork)
return true;
System.Threading.Thread.Sleep(1000);
TimeSpan ts = DateTime.Now - SD;
if (ts.TotalSeconds > 10)
{
return false;
}
}
}
#endregion
public static void RunExplorer(string arg)
{
System.Diagnostics.ProcessStartInfo si = new ProcessStartInfo("explorer");
si.Arguments = arg;
System.Diagnostics.Process.Start(si);
}
#region "web function"
/// <summary>
/// Receives a string from URL.
/// </summary>
/// <param name="url"></param>
/// <param name="isError"></param>
/// <returns></returns>
public static string GetStrfromurl(string url, out Boolean isError)
{
isError = false;
string result = "";
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url));
request.Timeout = 60000;
request.ReadWriteTimeout = 60000;
request.MaximumAutomaticRedirections = 4;
request.MaximumResponseHeadersLength = 4;
request.Credentials = CredentialCache.DefaultCredentials;
var response = request.GetResponse() as HttpWebResponse;
var txtReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
result = txtReader.ReadToEnd();
}
catch (Exception ex)
{
isError = true;
result = ex.Message.ToString();
}
return result;
}
#endregion
}
}

View File

@@ -0,0 +1,676 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using AR;
#if EMGU
using Emgu.CV;
using Emgu.CV.Structure;
#endif
#if V22
using Euresys.Open_eVision_22_12;
#else
using Euresys.Open_eVision_2_11;
#endif
namespace Project
{
public static class Util_Vision
{
public struct SCodeData
{
public Point[] corner;
public string data;
public string model;
public string version;
public string level;
public string sid;
public void SetSID(string sid_) { sid = sid_; }
public Rectangle rect
{
get
{
if (corner == null || corner.Length != 4) return Rectangle.Empty;
var minx = corner.Min(t => t.X);
var maxx = corner.Max(t => t.X);
var miny = corner.Min(t => t.Y);
var maxy = corner.Max(t => t.Y);
return new Rectangle((int)minx, (int)miny, (int)(maxx - minx), (int)(maxy - miny));
}
}
public float intersectPerc(Rectangle r)
{
//입력한 영역이 얼마나 겹쳐있는지
if (rect.IsEmpty) return 0f;
//현재 영역이랑 겹치는 영역이 없다면 0f
if (rect.IntersectsWith(r) == false) return 0f;
var cx = r.Left + r.Width / 2f;
var cy = r.Top + r.Height / 2f;
if (rect.Contains((int)cx, (int)cy)) return 1f;
if (rect.Contains(r)) return 1f;
return 0f;
}
}
public static void DisplayQRData(List<SCodeData> DataArr, Rectangle roi, arCtl.ImageBoxEvision iv)
{
iv.Shapes.Clear();
foreach (var item in DataArr)
{
var p = new PointF[4];
p[0] = new PointF(item.corner[0].X + roi.Left, item.corner[0].Y + roi.Top);
p[1] = new PointF(item.corner[1].X + roi.Left, item.corner[1].Y + roi.Top);
p[2] = new PointF(item.corner[2].X + roi.Left, item.corner[2].Y + roi.Top);
p[3] = new PointF(item.corner[3].X + roi.Left, item.corner[3].Y + roi.Top);
iv.Shapes.AddLine(p[0], p[1], Color.Gold, 5);
iv.Shapes.AddLine(p[1], p[2], Color.Gold, 5);
iv.Shapes.AddLine(p[2], p[3], Color.Gold, 5);
iv.Shapes.AddLine(p[3], p[0], Color.Gold, 5);
if (item.data.isEmpty() == false)
{
iv.Shapes.AddText(item.corner[1], item.data, Color.Black, 200f);
}
}
}
private static List<System.Drawing.PointF> GetGainOffsetList(string gainstr)
{
var retval = new List<System.Drawing.PointF>();
var list = gainstr.Split(';');
foreach (var item in list)
{
var ptitem = item.Split(',');
if (ptitem.Length == 2)
{
retval.Add(new System.Drawing.PointF(float.Parse(ptitem[0]), float.Parse(ptitem[1])));
}
}
return retval;
}
// static SoftekBarcodeNet.BarcodeReader barcode = null;// new SoftekBarcodeNet.BarcodeReader();
static List<Util_Vision.SCodeData> ReadQR_EVision(EImageBW8 TargetImage, EQRCodeReader EQRCode1, RectangleF rect)
{
var retval = new System.Collections.Generic.List<Util_Vision.SCodeData>();
EQRCode1.SearchField = TargetImage;
var EQRCode2Result = EQRCode1.Read();
for (int j = 0; j < EQRCode2Result.Length; j++)
{
var QrData = EQRCode2Result[j];
if (QrData.IsDecodingReliable)
{
var geo = QrData.Geometry;
var pos = geo.Position;
var cornous = pos.Corners;
var resultData = new Util_Vision.SCodeData();
//테두리좌표 읽기
var resultcorns = new List<Point>();
for (int k = 0; k < cornous.Length; k++)
{
var con = cornous[k];
resultcorns.Add(new Point((int)(con.X + rect.X), (int)(con.Y + rect.Y)));
con.Dispose();
}
resultData.corner = resultcorns.ToArray();
//데이터읽기
resultData.model = QrData.Model.ToString();
resultData.version = QrData.Version.ToString();
resultData.level = QrData.Level.ToString();
resultData.sid = string.Empty;
//바코드데이터확인
var decodestr = QrData.DecodedStream;
resultData.data = string.Empty;
foreach (var item in decodestr.DecodedStreamParts)
{
resultData.data += System.Text.Encoding.Default.GetString(item.DecodedData);
item.Dispose();
}
//var c = new Class.CAmkorSTDBarcode(resultData.data);
//if (c.isValid) resultData.sid = c.SID;
//else resultData.sid = string.Empty;
//if (c.isValid) break;
//else resultData.data = string.Empty;
//결과데이터 추가
if (resultData.data.isEmpty() == false)
{
if (retval.Where(t => t.data == resultData.data).Any() == false)
{
retval.Add(resultData);
}
}
decodestr.Dispose();
decodestr = null;
cornous = null;
pos.Dispose();
geo.Dispose();
}
QrData.Dispose();
}
return retval;
}
//static List<Util_Vision.SCodeData> ReadQR_Softtek(EImageBW8 Image, RectangleF roi, Boolean useMedianfilter = false, int timeout = 50)
//{
// if (barcode == null)
// {
// barcode = new SoftekBarcodeNet.BarcodeReader();
// barcode.LicenseKey = "PC6q6K38G6bG9EWMlQxDr4O8aQzJWPSB";
// Pub.log.Add("softtek barcode init");
// // Turn on the barcode types you want to read.
// // Turn off the barcode types you don't want to read (this will increase the speed of your application)
// barcode.ReadCode128 = false;
// barcode.ReadCode39 = false;
// barcode.ReadCode25 = false;
// barcode.ReadEAN13 = false;
// barcode.ReadEAN8 = false;
// barcode.ReadUPCA = false;
// barcode.ReadUPCE = false;
// barcode.ReadCodabar = false;
// barcode.ReadPDF417 = false;
// barcode.ReadDataMatrix = true;
// barcode.ReadDatabar = false;
// barcode.ReadMicroPDF417 = false;
// barcode.ReadQRCode = true;
// // If you want to read more than one barcode then set Multiple Read to 1
// // Setting MutlipleRead to False will make the recognition faster
// barcode.MultipleRead = false;
// barcode.MaxBarcodesPerPage = 1;
// barcode.UseFastScan = true;
// // You may need to set a small quiet zone if your barcodes are close to text and pictures in the image.
// // A value of zero uses the default.
// barcode.QuietZoneSize = 0; //사용하면 느려짐
// // LineJump controls the frequency at which scan lines in an image are sampled.
// // The default is 9 - decrease this for difficult barcodes.
// barcode.LineJump = 3; //속도가 빨라지나 결과 검출 영향 많이 줌
// // The value is a mask where 1 = Left to Right, 2 = Top to Bottom, 4 = Right To Left, 8 = Bottom to Top
// barcode.ScanDirection = 15; //방향을 조정해주면 속도 가 빨라짐
// barcode.ColorProcessingLevel = 2;
// barcode.MinLength = 4;
// barcode.MaxLength = 9999;
// }
// barcode.MedianFilter = useMedianfilter;//Pub.setting.CameraMeanFilter;
// barcode.TimeOut = timeout;// 50;// Pub.setting.CameraTimeOut;
// int nBarCode;
// var retval = new List<Util_Vision.SCodeData>();
// var Scan0 = Image.GetImagePtr();
// using (var bmp = new Bitmap(Image.Width, Image.Height, Image.RowPitch, System.Drawing.Imaging.PixelFormat.Format8bppIndexed, Scan0))
// {
// //비트맵 개체로 데이터를 읽어본다
// nBarCode = barcode.ScanBarCodeFromBitmap(bmp);
// if (nBarCode <= -6)
// {
// //Result.Text += "License key error: either an evaluation key has expired or the license key is not valid for processing pdf documents\r\n";
// }
// else if (nBarCode < 0)
// {
// //Result.Text += "ScanBarCode returned error number ";
// //Result.Text += nBarCode.ToString();
// //Result.Text += "\r\n";
// //Result.Text += "Last Softek Error Number = ";
// //Result.Text += barcode.GetLastError().ToString();
// //Result.Text += "\r\n";
// //Result.Text += "Last Windows Error Number = ";
// //Result.Text += barcode.GetLastWinError().ToString();
// //Result.Text += "\r\n";
// }
// else if (nBarCode == 0)
// {
// //Result.Text += "No barcode found on this image\r\n";
// }
// else
// {
// //Result.Text += "\r\n";
// for (int i = 1; i <= nBarCode; i++)
// {
// var rect = barcode.GetBarStringRect(i);
// var resultData = new SCodeData()
// {
// corner = new Point[] {
// new Point((int)(rect.Left+roi.X),(int)(rect.Top + roi.Y)),
// new Point((int)(rect.Right+roi.X),(int)(rect.Top+roi.Y)),
// new Point((int)(rect.Left+roi.X),(int)(rect.Bottom+roi.Y)),
// new Point((int)(rect.Right+roi.X),(int)(rect.Bottom+roi.Y))
// },
// data = barcode.GetBarString(i),
// level = string.Empty,
// model = string.Empty,
// sid = string.Empty,
// version = string.Empty,
// };
// //결과데이터 추가
// if (resultData.data.isEmpty() == false)
// {
// if (retval.Where(t => t.data == resultData.data).Any() == false)
// {
// retval.Add(resultData);
// }
// }
// }
// }
// return retval;
// }
//}
public static Tuple<List<SCodeData>, List<Rectangle>, List<Rectangle>, double> DetectQR(
EImageBW8 EBW8Image4,
arCtl.ImageBoxEvision iv1, int idx,
out string Message,
string erodevaluestr = "3,1",
string gainoffsetlist = "2,1",
uint blob_area_min = 20000,
uint blob_area_max = 70000,
float blob_sigmaxy = 500f,
float blob_sigmayy = 500f,
float blob_sigmaxx = 5000f,
float blob_minw = 50,
float blob_maxw = 350,
float blob_minh = 50,
float blob_maxh = 350,
//bool addSofttekRead = false,
string maskfile = "",
string finddata = ""//,
// Image<Bgr, byte> DispImage = null
)
{
Message = string.Empty;
var pts = new System.Collections.Generic.List<Util_Vision.SCodeData>();
System.Diagnostics.Stopwatch wat = new System.Diagnostics.Stopwatch();
wat.Restart();
List<RectangleF> ros = new List<RectangleF>();
List<Rectangle> whiterects = new List<Rectangle>();
uint objectCountT = 0;
//Blob 으로 바코드영역을 찾는다
using (ECodedImage2 codedImage4 = new ECodedImage2()) // ECodedImage2 instance
{
using (EImageEncoder codedImage4Encoder = new EImageEncoder()) // EIma
{
using (EObjectSelection codedImage4ObjectSelection = new EObjectSelection())
{
codedImage4ObjectSelection.FeretAngle = 0.00f;
//기본이미지에서 흰색영역을 찾아서 해당 영역만 처리한다.
using (var psegment = codedImage4Encoder.GrayscaleSingleThresholdSegmenter) //.BlackLayerEncoded = true;
{
psegment.BlackLayerEncoded = false;
psegment.WhiteLayerEncoded = true;
psegment.Mode = EGrayscaleSingleThreshold.MaxEntropy;
}
//마스크적용 - 210209
if (maskfile.isEmpty() == false && System.IO.File.Exists(maskfile))
{
using (var maskmig = new EImageBW8())
{
maskmig.Load(maskfile);//이미지불러오지
EasyImage.Oper(EArithmeticLogicOperation.BitwiseAnd, EBW8Image4, maskmig, EBW8Image4);
}
}
//흰색데이터강조
using (var deilimage = new EImageBW8(EBW8Image4.Width, EBW8Image4.Height))
{
EasyImage.DilateBox(EBW8Image4, deilimage, 30);
codedImage4Encoder.Encode(deilimage, codedImage4);
codedImage4ObjectSelection.Clear();
codedImage4ObjectSelection.AddObjects(codedImage4);
codedImage4ObjectSelection.RemoveUsingUnsignedIntegerFeature(EFeature.Area, 50000, ESingleThresholdMode.LessEqual);
for (uint i = 0; i < codedImage4ObjectSelection.ElementCount; i++)
{
var elm = codedImage4ObjectSelection.GetElement(i);
var x = elm.BoundingBoxCenterX - elm.BoundingBoxWidth / 2f;
var y = elm.BoundingBoxCenterY - elm.BoundingBoxHeight / 2f;
var w = elm.BoundingBoxWidth;
var h = elm.BoundingBoxHeight;
whiterects.Add(new Rectangle((int)x, (int)y, (int)w, (int)h));
elm.Dispose();
}
}
//침식해서 바코드영역이 뭉치도록 한다. (바코드는 검은색 영역이 된다)
List<uint> erodevalues = new List<uint>();
var erodebuffer = erodevaluestr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var erbuf in erodebuffer) erodevalues.Add(uint.Parse(erbuf));
using (var psegment = codedImage4Encoder.GrayscaleSingleThresholdSegmenter) //.BlackLayerEncoded = true;
{
psegment.BlackLayerEncoded = true;
psegment.WhiteLayerEncoded = false;
}
//QR코드예상위치를 저장할 영역변수
//찾은 흰색영역에서 작업을 진행한다
foreach (var roi in whiterects)
{
//각영역을 erod 처리하여 추가 영역을 찾는다
using (EROIBW8 roimage = new EROIBW8())
{
roimage.Attach(EBW8Image4);
roimage.SetPlacement(roi.X, roi.Y, roi.Width, roi.Height);
for (int maxtype = 0; maxtype < 2; maxtype++)
{
//침식데이터도 여러개를 사용한다.
foreach (var erodevalue in erodevalues)
{
//Erode image
using (var ErodeImageBW8 = new EImageBW8(roimage.Width, roimage.Height))
{
EasyImage.ErodeBox(roimage, ErodeImageBW8, erodevalue);
using (var psegment = codedImage4Encoder.GrayscaleSingleThresholdSegmenter)
{
if (maxtype == 0)
psegment.Mode = EGrayscaleSingleThreshold.MinResidue;
else if (maxtype == 1)
psegment.Mode = EGrayscaleSingleThreshold.MaxEntropy;
else if (maxtype == 2)
psegment.Mode = EGrayscaleSingleThreshold.IsoData;
}
codedImage4Encoder.Encode(ErodeImageBW8, codedImage4);
codedImage4ObjectSelection.Clear();
codedImage4ObjectSelection.AddObjects(codedImage4);
codedImage4ObjectSelection.AttachedImage = ErodeImageBW8;
//너무큰 개체를 제거한다.
codedImage4ObjectSelection.RemoveUsingUnsignedIntegerFeature(EFeature.Area, blob_area_min, ESingleThresholdMode.LessEqual);
codedImage4ObjectSelection.RemoveUsingUnsignedIntegerFeature(EFeature.Area, blob_area_max, ESingleThresholdMode.GreaterEqual);
codedImage4ObjectSelection.RemoveUsingFloatFeature(EFeature.BoundingBoxWidth, blob_minw, ESingleThresholdMode.LessEqual);
codedImage4ObjectSelection.RemoveUsingFloatFeature(EFeature.BoundingBoxWidth, blob_maxw, ESingleThresholdMode.GreaterEqual);
codedImage4ObjectSelection.RemoveUsingFloatFeature(EFeature.BoundingBoxHeight, blob_minh, ESingleThresholdMode.LessEqual);
codedImage4ObjectSelection.RemoveUsingFloatFeature(EFeature.BoundingBoxHeight, blob_maxh, ESingleThresholdMode.GreaterEqual);
//개체제거
codedImage4ObjectSelection.RemoveUsingFloatFeature(EFeature.SigmaXY, blob_sigmaxy, ESingleThresholdMode.GreaterEqual);
//codedImage4ObjectSelection.RemoveUsingFloatFeature(EFeature.SigmaYY, blob_sigmayy, ESingleThresholdMode.LessEqual);
codedImage4ObjectSelection.RemoveUsingFloatFeature(EFeature.SigmaXX, blob_sigmaxx, ESingleThresholdMode.GreaterEqual);
//찾은데이터수량
var objectCount = codedImage4ObjectSelection.ElementCount;
objectCountT += objectCount;
//데이터표시
//찾은영역을 표시한다.
for (uint i = 0; i < objectCount; i++)
{
//각 요소를 가져와서 처리한다.
using (var elm = codedImage4ObjectSelection.GetElement(i))
{
var x = elm.BoundingBoxCenterX - elm.BoundingBoxWidth / 2f;
var y = elm.BoundingBoxCenterY - elm.BoundingBoxHeight / 2f;
var w = elm.BoundingBoxWidth;
var h = elm.BoundingBoxHeight;
//절대좌표로 변경(
x += roimage.TotalOrgX;
y += roimage.TotalOrgY;
var rect = new RectangleF(x, y, w, h);
//이전 ROS에 겹치는 영역이 있다면 해당 ROS값을 확장해준다
bool find = false;
for (int j = 0; j < ros.Count; j++)
{
if (ros[j].IntersectsWith(rect))
{
//겹쳐있으니 영역을 확장해준다.
var x1 = Math.Min(ros[j].X, rect.X);
var y1 = Math.Min(ros[j].Y, rect.Y);
var w1 = Math.Max(ros[j].Right, rect.Right) - x1;
var h1 = Math.Max(ros[j].Bottom, rect.Bottom) - y1;
ros[j] = new RectangleF(x1, y1, w1, h1);
find = true;
break;
}
}
if (find == false) ros.Add(rect); //겹치는 영역이 없으니 추가한다.
}
}
}
}
}
}
}
//whitelist 에서 QR을 검색한다.(밝기조정없음)
var find2 = false;
//ROS에서 QR을 검색한다(밝기조정함)
if (find2 == false)
{
foreach (var roi in ros)
{
//대상자료를 찾았다면 멈춘다
if (ReadQRData(EBW8Image4, roi.toRect(), gainoffsetlist, ref pts, finddata))
{
find2 = true;
break;
}
}
}
if (find2 == false)
{
foreach (var roi in whiterects)
{
//대상자료를 찾았다면 멈춘다
if (ReadQRData(EBW8Image4, roi, "1,0", ref pts, finddata))
{
find2 = true; //대상을 찾았다면 더 진행하지 않는다
break;
}
}
}
}
}
}
wat.Stop();
//검사시간 저장
var rosrect = ros.Select(t => new Rectangle((int)t.X, (int)t.Y, (int)t.Width, (int)t.Height)).ToList();
return new Tuple<List<SCodeData>, List<Rectangle>, List<Rectangle>, double>(pts, whiterects, rosrect, wat.ElapsedMilliseconds);
}
/// <summary>
/// 지정한 영역에서 QR코드를 검색합니다.
/// </summary>
/// <param name="EBW8Image4"></param>
/// <param name="rect">검색영역</param>
/// <param name="gainoffsetlist">밝기변경값</param>
/// <param name="pts">결과저장소</param>
/// <param name="finddata">특정검색데이터</param>
/// <returns></returns>
static bool ReadQRData(EImageBW8 EBW8Image4, Rectangle rect, string gainoffsetlist, ref List<SCodeData> pts, string finddata = "")
{
var retval = false;
var GainOffsetList = GetGainOffsetList(gainoffsetlist);
//해당영역을 ROI로 잡고 이미지를 검색한다
var RoiImage2 = new EROIBW8();
RoiImage2.Attach(EBW8Image4);
//ROI로 사용할 영역의 오류를 체크해야한다
var rLeft = (int)rect.Left;
var rTop = (int)rect.Top;
if (rLeft < 0) rLeft = 0;
if (rTop < 0) rTop = 0;
var rWid = (int)rect.Width;
var rHei = (int)rect.Height;
//roi 오류수정 210621
if (rLeft + rWid > EBW8Image4.Width) rWid = EBW8Image4.Width - rLeft - 1;
if (rTop + rHei > EBW8Image4.Height) rHei = EBW8Image4.Height - rTop - 1;
var rourect = new Rectangle(rLeft, rTop, rWid, rHei);
RoiImage2.SetPlacement(rourect.Left, rourect.Top, rourect.Width, rourect.Height); //ROI적용
var TargetImage = new EImageBW8(RoiImage2.Width, RoiImage2.Height);
//밝기를 변경해서 처리해야한다
//int processCount = 9;
foreach (var param in GainOffsetList) //원본, gain +-, offset +- 5가지 색상처리함
{
//크기를 동일하게 맞춰야 한다
EasyImage.ScaleRotate(RoiImage2,
RoiImage2.Width / 2f, RoiImage2.Height / 2f,
TargetImage.Width / 2f, TargetImage.Height / 2f,
1.0f, 1.0f, 0f, TargetImage);
//EasyImage.Copy(RoiImage, TargetImage);
//밝기를 변경해서 사용할 것이므로 해당 변경된 밝기를 저장할 이미지를 생성한다. 210128
//var roiimg = new EImageBW8(TargetImage);
//var param = Util_Vision.GetGainOffset(bright);
if (param.X != 1.0f || param.Y != 0.0f) EasyImage.GainOffset(TargetImage, TargetImage, param.X, param.Y);
//else RoiImage.CopyTo(TargetImage); ;// TargetImage.CopyTo(roiimg); //변경하지 않고 그대로 사용한다
using (EQRCodeReader EQRCode1 = new EQRCodeReader())
{
//EQRCode1.DetectionMethod = 15; //모든방법으로 데이터를 찾는다
EQRCode1.TimeOut = 1000 * 1000; //timeout (1초)
if (TargetImage.Width < 500 || TargetImage.Height < 500)
EQRCode1.ForegroundDetectionThreshold = 3;
var datas = ReadQR_EVision(TargetImage, EQRCode1, rect);
if (datas.Any())
{
//중복데이터는 제거한다 211211
foreach (var dataitem in datas)
{
if (pts.Where(t => t.data == dataitem.data).Any() == false)
pts.Add(dataitem);
else if (pts.Where(t => t.intersectPerc(dataitem.rect) > 0f).Any() == false)
pts.Add(dataitem);
//해당 데이터가 찾는 데이터라면 진행을 멈춘다
if (finddata.isEmpty() == false && dataitem.data.Equals(finddata))
{
//검색대상 자료이므로 진행을 멈춘다
retval = true;
break;
}
//해당데이터가 amkor standard 라면 문제없이 진행한다.
var splitbuf = dataitem.data.Split(';');
if (splitbuf.Length > 6 && splitbuf[0].StartsWith("10"))
{
//amkor std 라벨이므로 진행하지 않습니다.
retval = true;
break;
}
}
//pts.AddRange(datas);
}
//sDisplayQRInfo(datas, iv1);
}
if (retval == true) break; //대상자료르 찾았다면 진행을 멈춘다
}
RoiImage2.Dispose();
TargetImage.Dispose();
TargetImage = null;
return retval;
}
#if EMGU
static void DisplayQRInfo(List<Util_Vision.SCodeData> datas, arImageViewer.EVision.UI.CustomControl1 iv1)
#else
static void DisplayQRInfo(List<Util_Vision.SCodeData> datas, arCtl.ImageBoxEvision iv1)
#endif
{
if (iv1 == null) return;
var idx = 0;
foreach (var resultData in datas)
{
//var c = new Class.CAmkorSTDBarcode(resultData.data);
//if (c.isValid) resultData.SetSID(c.SID); // = c.SID;
//else resultData.SetSID(string.Empty);
//결과데이터 추가
if (resultData.data.isEmpty() == false)
{
//자료가잇다면 표시한다.
var dispvalue = $"#{idx}";// resultData.data;
//if (c.isValid == false) dispvalue += "\n" + c.Message;
//else if (c.DateError) dispvalue += "\n** Date Error **";
iv1.Shapes.AddText(resultData.corner[1].X + 1, resultData.corner[1].Y + 1, dispvalue, Color.Black, 50);
iv1.Shapes.AddText(resultData.corner[1].X, resultData.corner[1].Y, dispvalue, Color.Yellow, 50);
//if (DispImage != null)
// CvInvoke.PutText(DispImage,
// dispvalue,
// new Point(resultData.corner[1].X, resultData.corner[1].Y), FontFace.HersheyDuplex, 2,
// new Bgr(Color.Tomato).MCvScalar, 2);
//찾은테두리를 화면에 표시한다.
foreach (var pt in resultData.corner)
{
iv1.Shapes.AddPoint(pt, Color.Lime, 20f);
//if (DispImage != null)
//{
// CvInvoke.Line(DispImage,
// new Point(pt.X - 10, pt.Y - 10),
// new Point(pt.X + 10, pt.Y + 10),
// new Bgr(Color.Lime).MCvScalar, 2);
// CvInvoke.Line(DispImage,
// new Point(pt.X + 10, pt.Y - 10),
// new Point(pt.X - 10, pt.Y + 10),
// new Bgr(Color.Lime).MCvScalar, 2);
//}
}
}
idx++;
}
}
}
}

View File

@@ -0,0 +1,304 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{65F3E762-800C-499E-862F-A535642EC59F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Project</RootNamespace>
<AssemblyName>CrevisQRCode</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>게시\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NoWin32Manifest>False</NoWin32Manifest>
<SignAssembly>False</SignAssembly>
<DelaySign>False</DelaySign>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<OutputPath>..\..\..\..\..\amkor\ReelSorter\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\ManualMapEditor\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icons8_iris_scan_80_XQd_icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\..\..\CrevisQRCode%28L%29\</OutputPath>
<DefineConstants>TRACE;DEBUG;V2,EMGU</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<StartAction>Project</StartAction>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<BaseAddress>4194304</BaseAddress>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="ArLog.Net4">
<HintPath>..\DLL\ArLog.Net4.dll</HintPath>
</Reference>
<Reference Include="ArSetting.Net4, Version=19.7.3.2330, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\ArSetting.Net4.dll</HintPath>
</Reference>
<Reference Include="ChilkatDotNet4">
<HintPath>..\DLL\ChilkatDotNet4.dll</HintPath>
</Reference>
<Reference Include="Crevis.VirtualFG40Library, Version=4.4.6820.30340, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\Crevis\x86\Crevis.VirtualFG40Library.dll</HintPath>
</Reference>
<Reference Include="Emgu.CV.DebuggerVisualizers.VS2017, Version=3.2.0.2682, Culture=neutral, PublicKeyToken=7281126722ab4438, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\Emgu\Emgu.CV.DebuggerVisualizers.VS2017.dll</HintPath>
</Reference>
<Reference Include="Emgu.CV.UI, Version=3.2.0.2682, Culture=neutral, PublicKeyToken=7281126722ab4438, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\Emgu\Emgu.CV.UI.dll</HintPath>
</Reference>
<Reference Include="Emgu.CV.World, Version=3.2.0.2682, Culture=neutral, PublicKeyToken=7281126722ab4438, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\Emgu\Emgu.CV.World.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Open_eVision_NetApi_2_11, Version=2.11.1.12832, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Euresys\Open eVision 2.11\Bin32\Open_eVision_NetApi_2_11.dll</HintPath>
</Reference>
<Reference Include="SoftekBarcodeNet">
<HintPath>..\DLL\SoftekBarcodeNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WatsonWebsocket">
<HintPath>..\DLL\WatsonWebsocket.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Class\CAmkorSTDBarcode.cs" />
<Compile Include="Class\CInterLock.cs" />
<Compile Include="Class\Flag.cs" />
<Compile Include="Class\Win32API.cs" />
<Compile Include="Dialog\fTeach.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialog\fTeach.Designer.cs">
<DependentUpon>fTeach.cs</DependentUpon>
</Compile>
<Compile Include="Don%27t change it\Dialog\fLog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Don%27t change it\Dialog\fLog.Designer.cs">
<DependentUpon>fLog.cs</DependentUpon>
</Compile>
<Compile Include="Don%27t change it\Dialog\fErrorException.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Don%27t change it\Dialog\fErrorException.Designer.cs">
<DependentUpon>fErrorException.cs</DependentUpon>
</Compile>
<Compile Include="fMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="fMain.Designer.cs">
<DependentUpon>fMain.cs</DependentUpon>
</Compile>
<Compile Include="Setting\fSetting.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Setting\fSetting.Designer.cs">
<DependentUpon>fSetting.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Pub.cs" />
<Compile Include="Setting\CSetting.cs" />
<Compile Include="StateMachine\EnumStruct.cs" />
<Compile Include="StateMachine\EventArgs.cs" />
<Compile Include="StateMachine\_Socket.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Util_Vision.cs" />
<Compile Include="StateMachine\_Close.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StateMachine\_TMDisplay.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StateMachine\DisplayTextHandler.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Util.cs" />
<Compile Include="StateMachine\_Crevis.cs">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="Dialog\fTeach.resx">
<DependentUpon>fTeach.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Don%27t change it\Dialog\fLog.resx">
<DependentUpon>fLog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Don%27t change it\Dialog\fErrorException.resx">
<DependentUpon>fErrorException.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="fMain.resx">
<DependentUpon>fMain.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Setting\fSetting.resx">
<DependentUpon>fSetting.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4%28x86 및 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
<Visible>False</Visible>
<ProductName>Windows Installer 4.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CapCleaningControl\UIControl.csproj">
<Project>{9264cd2e-7cf8-4237-a69f-dcda984e0613}</Project>
<Name>UIControl</Name>
</ProjectReference>
<ProjectReference Include="..\Sub\arCtl\arControl.csproj">
<Project>{f31c242c-1b15-4518-9733-48558499fe4b}</Project>
<Name>arControl</Name>
</ProjectReference>
<ProjectReference Include="..\Sub\arFrameControl\arFrameControl.csproj">
<Project>{a16c9667-5241-4313-888e-548375f85d29}</Project>
<Name>arFrameControl</Name>
</ProjectReference>
<ProjectReference Include="..\Sub\arImageViewer.EVision\arImageViewer.EVision_v22.csproj">
<Project>{c42cd2f4-5adb-4728-b654-ad9c2e1b22e7}</Project>
<Name>arImageViewer.EVision_v22</Name>
</ProjectReference>
<ProjectReference Include="..\Sub\arMCFrame\MemoryMapCore\MemoryMapCore.csproj">
<Project>{140af52a-5986-4413-bf02-8ea55a61891b}</Project>
<Name>MemoryMapCore</Name>
</ProjectReference>
<ProjectReference Include="..\Sub\CommUtil\arCommUtil.csproj">
<Project>{14e8c9a5-013e-49ba-b435-ffffff7dd623}</Project>
<Name>arCommUtil</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="icons8_iris_scan_80_XQd_icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,294 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{65F3E762-800C-499E-862F-A535642EC500}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Project</RootNamespace>
<AssemblyName>CrevisQRCode</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>게시\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NoWin32Manifest>False</NoWin32Manifest>
<SignAssembly>False</SignAssembly>
<DelaySign>False</DelaySign>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<OutputPath>..\..\..\..\..\amkor\ReelSorter\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\ManualMapEditor\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icons8_iris_scan_80_XQd_icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\..\..\..\amkor\CrevisQRCode\</OutputPath>
<DefineConstants>TRACE;DEBUG;V22</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<StartAction>Project</StartAction>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<BaseAddress>4194304</BaseAddress>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="arCommUtil, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\arCommUtil.dll</HintPath>
</Reference>
<Reference Include="ChilkatDotNet4">
<HintPath>..\DLL\ChilkatDotNet4.dll</HintPath>
</Reference>
<Reference Include="Crevis.VirtualFG40Library, Version=4.4.6820.30340, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\CREVIS\Cameras\MCam40\bin\x64\Crevis.VirtualFG40Library.dll</HintPath>
</Reference>
<Reference Include="Emgu.CV.DebuggerVisualizers.VS2017, Version=3.2.0.2682, Culture=neutral, PublicKeyToken=7281126722ab4438, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\Emgu\Emgu.CV.DebuggerVisualizers.VS2017.dll</HintPath>
</Reference>
<Reference Include="Emgu.CV.UI, Version=3.2.0.2682, Culture=neutral, PublicKeyToken=7281126722ab4438, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\Emgu\Emgu.CV.UI.dll</HintPath>
</Reference>
<Reference Include="Emgu.CV.World, Version=3.2.0.2682, Culture=neutral, PublicKeyToken=7281126722ab4438, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\Emgu\Emgu.CV.World.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Open_eVision_NetApi_22_12, Version=22.12.1.14930, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Euresys\Open eVision 22.12\Bin64\Open_eVision_NetApi_22_12.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WatsonWebsocket">
<HintPath>..\DLL\WatsonWebsocket.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Class\CAmkorSTDBarcode.cs" />
<Compile Include="Class\CInterLock.cs" />
<Compile Include="Class\Flag.cs" />
<Compile Include="Class\WebSocket.cs" />
<Compile Include="Class\Win32API.cs" />
<Compile Include="Dialog\fviewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialog\fviewer.Designer.cs">
<DependentUpon>fviewer.cs</DependentUpon>
</Compile>
<Compile Include="Dialog\fTeach.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialog\fTeach.Designer.cs">
<DependentUpon>fTeach.cs</DependentUpon>
</Compile>
<Compile Include="Dialog\fErrorException.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialog\fErrorException.Designer.cs">
<DependentUpon>fErrorException.cs</DependentUpon>
</Compile>
<Compile Include="fMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="fMain.Designer.cs">
<DependentUpon>fMain.cs</DependentUpon>
</Compile>
<Compile Include="LogTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="LogTextBox.Designer.cs">
<DependentUpon>LogTextBox.cs</DependentUpon>
</Compile>
<Compile Include="Setting\fSetting.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Setting\fSetting.Designer.cs">
<DependentUpon>fSetting.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PUB.cs" />
<Compile Include="Setting\CSetting.cs" />
<Compile Include="StateMachine\EnumStruct.cs" />
<Compile Include="StateMachine\EventArgs.cs" />
<Compile Include="StateMachine\_BW_Conn.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StateMachine\_BW_Right.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StateMachine\_Socket.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StateMachine\_BW_Left.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Util_Vision.cs" />
<Compile Include="StateMachine\_Close.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StateMachine\_TMDisplay.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StateMachine\DisplayTextHandler.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Util.cs" />
<Compile Include="StateMachine\_Crevis.cs">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="Dialog\fviewer.resx">
<DependentUpon>fviewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Dialog\fTeach.resx">
<DependentUpon>fTeach.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Dialog\fErrorException.resx">
<DependentUpon>fErrorException.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="fMain.resx">
<DependentUpon>fMain.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Setting\fSetting.resx">
<DependentUpon>fSetting.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4%28x86 및 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
<Visible>False</Visible>
<ProductName>Windows Installer 4.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sub\arImageViewer.EVision\arImageViewer.EVision_v22.csproj">
<Project>{c42cd2f4-5adb-4728-b654-ad9c2e1b22e7}</Project>
<Name>arImageViewer.EVision_v22</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="icons8_iris_scan_80_XQd_icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Project.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Project.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<connectionStrings />
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup><userSettings>
<Project.Properties.Settings>
<setting name="chilkat" serializeAs="String">
<value>BLUPRT.CBX012020_rzDFf7pQAsCS</value>
</setting>
</Project.Properties.Settings>
</userSettings>
<applicationSettings>
<Project.Properties.Settings>
<setting name="Logistics_Vision_wr_ZK_RFID_TRANS_SEQService"
serializeAs="String">
<value>http://k1xip00.amkor.co.kr:50000/XISOAPAdapter/MessageServlet?senderParty=&amp;senderService=eCIM_ATK&amp;receiverParty=&amp;receiverService=&amp;interface=ZK_RFID_TRANS_SEQ&amp;interfaceNamespace=urn%3Asap-com%3Adocument%3Asap%3Arfc%3Afunctions</value>
</setting>
</Project.Properties.Settings>
</applicationSettings>
</configuration>

2472
QRValidation/Project/fMain.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,898 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Threading;
using static Project.Util_Vision;
using AR;
using Euresys.Open_eVision_22_12;
namespace Project
{
public partial class fMain : Form
{
Boolean exit = false;
Boolean bRunConnection = true;
private arCtl.LogTextBox rtLogR;
private arCtl.LogTextBox rtLogL;
public fMain()
{
InitializeComponent();
InitRTLog();
PUB.mre[0] = new ManualResetEvent(true);
PUB.mre[1] = new ManualResetEvent(true);
PUB.mre_send[0] = new ManualResetEvent(true);
PUB.mre_send[1] = new ManualResetEvent(true);
this.KeyDown += (s1, e1) =>
{
if (e1.KeyCode == Keys.Escape) this.Close();
if (DateTime.Now > PUB.LastInputTime) PUB.LastInputTime = DateTime.Now;
};
//dotList = new List<arCtl.arLabel>();
//dotList.AddRange(new arCtl.arLabel[] { lbDot1, lbDot2, lbDot3, lbDot4, lbDot5, lbDot6, lbDot7, lbDot8, lbDot9, lbDot10 });
this.MouseMove += (s1, e1) => { if (DateTime.Now > PUB.LastInputTime) PUB.LastInputTime = DateTime.Now; };
this.FormClosing += __Closing;
PUB._hDevice[0] = -1;
PUB._hDevice[1] = -1;
if (System.Diagnostics.Debugger.IsAttached) this.TopMost = false;
//else this.TopMost = true;
PUB.imgque.Push(this.Name);
PUB.RemoteCommand += PUB_RemoteCommand;
}
void InitRTLog()
{
this.rtLogR = new arCtl.LogTextBox();
this.rtLogL = new arCtl.LogTextBox();
arCtl.sLogMessageColor sLogMessageColor1 = new arCtl.sLogMessageColor();
arCtl.sLogMessageColor sLogMessageColor2 = new arCtl.sLogMessageColor();
arCtl.sLogMessageColor sLogMessageColor3 = new arCtl.sLogMessageColor();
arCtl.sLogMessageColor sLogMessageColor4 = new arCtl.sLogMessageColor();
arCtl.sLogMessageColor sLogMessageColor5 = new arCtl.sLogMessageColor();
arCtl.sLogMessageColor sLogMessageColor6 = new arCtl.sLogMessageColor();
arCtl.sLogMessageColor sLogMessageColor7 = new arCtl.sLogMessageColor();
arCtl.sLogMessageColor sLogMessageColor8 = new arCtl.sLogMessageColor();
//
// rtLogR
//
this.rtLogR.BackColor = System.Drawing.SystemColors.Control;
this.rtLogR.BorderStyle = System.Windows.Forms.BorderStyle.None;
sLogMessageColor1.color = System.Drawing.Color.Black;
sLogMessageColor1.gubun = "NOR";
sLogMessageColor2.color = System.Drawing.Color.Red;
sLogMessageColor2.gubun = "ERR";
sLogMessageColor3.color = System.Drawing.Color.Tomato;
sLogMessageColor3.gubun = "WARN";
sLogMessageColor4.color = System.Drawing.Color.DeepSkyBlue;
sLogMessageColor4.gubun = "MSG";
this.rtLogR.ColorList = new arCtl.sLogMessageColor[] {
sLogMessageColor1,
sLogMessageColor2,
sLogMessageColor3,
sLogMessageColor4};
this.rtLogR.DateFormat = "mm:ss.fff";
this.rtLogR.DefaultColor = System.Drawing.Color.LightGray;
this.rtLogR.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtLogR.EnableDisplayTimer = false;
this.rtLogR.EnableGubunColor = true;
this.rtLogR.Font = new System.Drawing.Font("Consolas", 9F);
this.rtLogR.ListFormat = "[{0}] {1}";
this.rtLogR.Location = new System.Drawing.Point(587, 3);
this.rtLogR.MaxListCount = ((ushort)(200));
this.rtLogR.MaxTextLength = ((uint)(4000u));
this.rtLogR.MessageInterval = 50;
this.rtLogR.Name = "rtLogR";
this.rtLogR.Size = new System.Drawing.Size(578, 626);
this.rtLogR.TabIndex = 136;
this.rtLogR.Text = "";
//
// rtLogL
//
this.rtLogL.BackColor = System.Drawing.SystemColors.Control;
this.rtLogL.BorderStyle = System.Windows.Forms.BorderStyle.None;
sLogMessageColor5.color = System.Drawing.Color.Black;
sLogMessageColor5.gubun = "NOR";
sLogMessageColor6.color = System.Drawing.Color.Red;
sLogMessageColor6.gubun = "ERR";
sLogMessageColor7.color = System.Drawing.Color.Tomato;
sLogMessageColor7.gubun = "WARN";
sLogMessageColor8.color = System.Drawing.Color.DeepSkyBlue;
sLogMessageColor8.gubun = "MSG";
this.rtLogL.ColorList = new arCtl.sLogMessageColor[] {
sLogMessageColor5,
sLogMessageColor6,
sLogMessageColor7,
sLogMessageColor8};
this.rtLogL.DateFormat = "mm:ss.fff";
this.rtLogL.DefaultColor = System.Drawing.Color.LightGray;
this.rtLogL.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtLogL.EnableDisplayTimer = false;
this.rtLogL.EnableGubunColor = true;
this.rtLogL.Font = new System.Drawing.Font("Consolas", 9F);
this.rtLogL.ListFormat = "[{0}] {1}";
this.rtLogL.Location = new System.Drawing.Point(3, 3);
this.rtLogL.MaxListCount = ((ushort)(200));
this.rtLogL.MaxTextLength = ((uint)(4000u));
this.rtLogL.MessageInterval = 50;
this.rtLogL.Name = "rtLogL";
this.rtLogL.Size = new System.Drawing.Size(578, 626);
this.rtLogL.TabIndex = 136;
this.rtLogL.Text = "";
this.tableLayoutPanel2.Controls.Add(this.rtLogR, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.rtLogL, 0, 0);
}
private void PUB_RemoteCommand(object sender, remoteargs e)
{
switch (e.Command)
{
case remotelist.barcodeupdate:
this.BeginInvoke(new Action(() =>
{
if (e.CamIdx == PUB.setting.CameraIndexL)
{
rtLeft.Text = e.strdata;
}
else
{
rtRight.Text = e.strdata;
}
}));
break;
}
}
void addsendlogmsg(RichTextBox rt, string msg)
{
if (rt.InvokeRequired)
{
rt.BeginInvoke(new Action<RichTextBox, string>(addsendlogmsg), new object[] { rt, msg });
}
else
{
string pretext = "";
if (rt.TextLength > 500)
{
pretext = rt.Text.Substring(400);
rt.Clear();
}
rt.AppendText(pretext + "\n" + msg);
}
}
private void __Closing(object sender, FormClosingEventArgs e)
{
if (exit == false)
{
// viewmode(true);
e.Cancel = true;
return;
}
else
{
if (UTIL.MsgQ("Do you really want to exit?") != DialogResult.Yes)
{
e.Cancel = true;
return;
}
else
{
_Close_Start();
}
}
}
void UpdateControl()
{
this.Text = Application.ProductName + " ver " + Application.ProductVersion + $"({PUB.setting.cameraname})";
if (PUB.wsock_[0] != null)
{
PUB.wsock_[0].TargetIdx = PUB.setting.CameraIndexL;
PUB.wsock_[0].Target = eTarget.Left;
}
if (PUB.wsock_[1] != null)
{
PUB.wsock_[1].TargetIdx = PUB.setting.CameraIndexR;
PUB.wsock_[1].Target = eTarget.Right;
}
}
private void __Load(object sender, EventArgs e)
{
PUB.log_[0].RaiseMsg += Log_RaiseMsgL;
PUB.log_[1].RaiseMsg += Log_RaiseMsgR;
// if (System.Diagnostics.Debugger.IsAttached) viewmode(false);
// else viewmode(true);
this.Show();
Application.DoEvents();
//Shared memory setup 230811
//if (PUB.setting.CameraIndexL >= 0)
//{
// swplc[0] = new AR.MemoryMap.Server("crevisv22L", 1024);
// swplc[0].Idx = (int)PUB.setting.CameraIndexL;
// swplc[0].ValueChanged += Plc_ValueChanged;
// swplc[0].Start();
//}
//if (PUB.setting.CameraIndexR >= 0)
//{
// swplc[1] = new AR.MemoryMap.Server("crevisv22R", 1024);
// swplc[1].Idx = (int)PUB.setting.CameraIndexR;
// swplc[1].ValueChanged += Plc_ValueChanged;
// swplc[1].Start();
//}
//Socket initialization
//Pub.log.Add("Socket event assignment");
//Pub.wsListen.ConnectionRequest += WsListen_ConnectionRequest;
//Application.DoEvents();
PUB.log_[0].Add($"Server listening port:{PUB.setting.listenPortL}");
try
{
PUB.wsock_[0] = new Class.WebSocket("127.0.0.1", PUB.setting.listenPortL);
PUB.wsock_[0].TargetIdx = PUB.setting.CameraIndexL;
PUB.wsock_[0].Target = eTarget.Left;
PUB.wsock_[0].Start();
PUB.wsock_[0].MessageReceived += Ws_DataArrival;
PUB.wsock_[0].ClientConnected += Ws_Connected;
PUB.wsock_[0].ClientDisconnected += Ws_Disconnected;
PUB.log_[0].Add("Camera initialization");
}
catch (Exception ex)
{
PUB.wsock_[0].MessageReceived -= Ws_DataArrival;
PUB.wsock_[0].ClientConnected -= Ws_Connected;
PUB.wsock_[0].ClientDisconnected -= Ws_Disconnected;
PUB.log_[0].AddE("Server listen failed:" + ex.Message);
}
PUB.log_[1].Add($"Server listening port:{PUB.setting.listenPortR}");
try
{
PUB.wsock_[1] = new Class.WebSocket("127.0.0.1", PUB.setting.listenPortR);
PUB.wsock_[1].TargetIdx = PUB.setting.CameraIndexR;
PUB.wsock_[1].Target = eTarget.Right;
PUB.wsock_[1].Start();
PUB.wsock_[1].MessageReceived += Ws_DataArrival;
PUB.wsock_[1].ClientConnected += Ws_Connected;
PUB.wsock_[1].ClientDisconnected += Ws_Disconnected;
PUB.log_[1].Add("Camera initialization");
}
catch (Exception ex)
{
PUB.wsock_[1].MessageReceived -= Ws_DataArrival;
PUB.wsock_[1].ClientConnected -= Ws_Connected;
PUB.wsock_[1].ClientDisconnected -= Ws_Disconnected;
PUB.log_[1].AddE("Server listen failed:" + ex.Message);
}
Application.DoEvents();
_SM_RUN_INIT_CAMERA();
tmDisplay.Start(); //start Display
PUB.flag.set(eFlag.CHECKLICENSE, true, "LOAD");
PUB.flag.set(eFlag.CHECKCAMERAL, true, "LOAD");
PUB.flag.set(eFlag.CHECKCAMERAR, true, "LOAD");
Task.Run(new Action(() =>
{
//license chedk
try
{
using (var img = new EImageBW8())
{
PUB.log_[0].Add("evision check OK");
PUB.log_[1].Add("evision check OK");
}
PUB.VisionLicense = true;
}
catch (Exception ex)
{
PUB.VisionLicense = false;
PUB.log_[0].AddE($"evision check Error:{ex.Message}");
PUB.log_[1].AddE($"evision check Error:{ex.Message}");
}
PUB.flag.set(eFlag.CHECKLICENSE, false, "LOAD");
// panMiniDisplay.Invalidate();
}));
UpdateControl();
PUB.log_[0].Add($"Program start(left:{PUB.setting.CameraIndexL})");
PUB.log_[1].Add($"Program start(right:{PUB.setting.CameraIndexR})");
//PUB.CheckNRegister3(Application.ProductName, "chi", Application.ProductVersion);
//Image collection thread start - 231003
bwLeft.RunWorkerAsync();
bwRight.RunWorkerAsync();
bwConn.RunWorkerAsync();
//set live mode
if (PUB.setting.CameraIndexL >= 0) PUB.IsLive[PUB.setting.CameraIndexL] = true;
if (PUB.setting.CameraIndexR >= 0) PUB.IsLive[PUB.setting.CameraIndexR] = true;
if (PUB.setting.CameraIndexL >= 0) PUB.IsProcess[PUB.setting.CameraIndexL] = true;
if (PUB.setting.CameraIndexR >= 0) PUB.IsProcess[PUB.setting.CameraIndexR] = true;
}
//private void Plc_ValueChanged(object sender, AR.MemoryMap.Core.monitorvalueargs e)
//{
// var ws = sender as AR.MemoryMap.Server;
//}
#region "Mouse Drag"
Boolean mousecap = false;
Point mousepos;
private void Panel1_MouseDown(object sender, MouseEventArgs e)
{
mousepos = e.Location;
mousecap = true;
// panMiniDisplay.Invalidate();
}
private void Panel1_DoubleClick(object sender, EventArgs e)
{
// viewmode(false);
this.Invalidate();
}
private void Panel1_MouseMove(object sender, MouseEventArgs e)
{
if (mousecap)
{
var offx = e.Location.X - mousepos.X;
var offy = e.Location.Y - mousepos.Y;
this.Location = new Point(this.Location.X + offx, this.Location.Y + offy);
//mousepos = e.Location;
}
}
private void Panel1_MouseUp(object sender, MouseEventArgs e)
{
mousecap = false;
}
#endregion
private void Log_RaiseMsgL(DateTime LogTime, string TypeStr, string Message)
{
if (this.rtLogL != null)
this.rtLogL.AddMsg(LogTime, TypeStr, Message);
}
private void Log_RaiseMsgR(DateTime LogTime, string TypeStr, string Message)
{
if (this.rtLogR != null)
this.rtLogR.AddMsg(LogTime, TypeStr, Message);
}
#region "Mouse Form Move"
private Boolean fMove = false;
private Point MDownPos;
private void LbTitle_DoubleClick(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized) this.WindowState = FormWindowState.Normal;
else this.WindowState = FormWindowState.Maximized;
//this.loader1.RemakeRect();
}
private void LbTitle_MouseMove(object sender, MouseEventArgs e)
{
if (fMove)
{
Point offset = new Point(e.X - MDownPos.X, e.Y - MDownPos.Y);
this.Left += offset.X;
this.Top += offset.Y;
offset = new Point(0, 0);
}
}
private void LbTitle_MouseUp(object sender, MouseEventArgs e)
{
fMove = false;
}
private void LbTitle_MouseDown(object sender, MouseEventArgs e)
{
MDownPos = new Point(e.X, e.Y);
fMove = true;
}
#endregion
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
Util.RunExplorer(Util.CurrentPath);
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
PUB.LogFlush();
var fi = new System.IO.FileInfo(PUB.log_[0].FileName);
Util.RunExplorer(fi.Directory.FullName);
}
private void ToolStripMenuItem1_Click(object sender, EventArgs e)
{
string savefile = System.IO.Path.Combine(Util.CurrentPath, "ScreenShot", DateTime.Now.ToString("yyyyMMddHHmmss") + ".png");
var grpath = new System.IO.FileInfo(savefile);
Util.RunExplorer(grpath.Directory.FullName);
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
var path = System.IO.Path.Combine(
PUB.setting.Path_Data, "History",
DateTime.Now.Year.ToString("0000"),
DateTime.Now.Month.ToString("00"),
DateTime.Now.Day.ToString("00"));
if (System.IO.Directory.Exists(path))
Util.RunExplorer(path);
else
Util.RunExplorer(System.IO.Path.Combine(PUB.setting.Path_Data, "History"));
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
var path = System.IO.Path.Combine(
PUB.setting.Path_Data, "Images",
DateTime.Now.Year.ToString("0000"),
DateTime.Now.Month.ToString("00"),
DateTime.Now.Day.ToString("00"));
if (System.IO.Directory.Exists(path))
Util.RunExplorer(path);
else
Util.RunExplorer(System.IO.Path.Combine(PUB.setting.Path_Data, "History"));
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
var path = System.IO.Path.Combine(
PUB.setting.Path_Data, "Count",
DateTime.Now.Year.ToString("0000"),
DateTime.Now.Month.ToString("00"),
DateTime.Now.Day.ToString("00"));
if (System.IO.Directory.Exists(path))
Util.RunExplorer(path);
else
Util.RunExplorer(System.IO.Path.Combine(PUB.setting.Path_Data, "History"));
}
private void exceptionTestToolStripMenuItem_Click(object sender, EventArgs e)
{
int a = 0;
int b = 1;
var c = b / a;
}
private void processListToolStripMenuItem_Click(object sender, EventArgs e)
{
PUB.log_[0].Add("process list");
PUB.log_[1].Add("process list");
foreach (var prc in System.Diagnostics.Process.GetProcesses())
{
if (prc.ProcessName.StartsWith("svchost")) continue;
if (prc.ProcessName.Contains(".host")) continue;
PUB.log_[0].Add(prc.ProcessName);
PUB.log_[1].Add(prc.ProcessName);
}
}
private void errorHandleToolStripMenuItem_Click(object sender, EventArgs e)
{
int a = 3;
int b = 0;
var c = a / b;
}
private void toolStripButton4_Click(object sender, EventArgs e)
{
//라이브, 프로세스, 트리거상태 보존
var l0 = PUB.IsLive[0];
var t0 = PUB.IsTrigger[0];
var p0 = PUB.IsProcess[0];
for (int i = 0; i < 2; i++)
{
PUB.IsLive[i] = false;
PUB.IsTrigger[i] = false;
PUB.IsProcess[i] = false;
}
using (var f = new fSetting())
{
f.TopMost = true;
f.ShowDialog();
}
UpdateControl();
if (PUB.setting.CameraIndexL >= 0)
{
PUB.IsLive[PUB.setting.CameraIndexL] = l0;
PUB.IsTrigger[PUB.setting.CameraIndexL] = t0;
PUB.IsProcess[PUB.setting.CameraIndexL] = p0;
}
if (PUB.setting.CameraIndexR >= 0)
{
PUB.IsLive[PUB.setting.CameraIndexR] = l0;
PUB.IsTrigger[PUB.setting.CameraIndexR] = t0;
PUB.IsProcess[PUB.setting.CameraIndexR] = p0;
}
}
private void toolStripButton5_Click(object sender, EventArgs e)
{
Util.RunExplorer(PUB.setting.ImageSavePath);
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
exit = true;
this.Close();
}
private void toolStripButton7_Click(object sender, EventArgs e)
{
exit = true;
this.Close();
}
private void toolStripButton9_Click_2(object sender, EventArgs e)
{
//camera image save
var bt = sender as ToolStripButton;
var camidx = bt.Name.Equals("toolStripButton9") ? PUB.setting.CameraIndexL : PUB.setting.CameraIndexR;
var logIdx = camidx == PUB.setting.CameraIndexL ? 0 : 1;
var sd = new SaveFileDialog();
sd.Filter = "bitmap|*.bmp";
if (sd.ShowDialog() != DialogResult.OK) return;
//이미지가 없다면 한장 찍는다
//if (this.iv[camidx].Image == null) CrevisGrab(camidx, true);
if (PUB.mre[camidx].WaitOne(100))
{
PUB.mre[camidx].Reset();
if (PUB.OrgImage[camidx] != null && PUB.OrgImage[camidx].IsVoid == false)
{
PUB.OrgImage[camidx].Save(sd.FileName);
PUB.log_[logIdx].Add($"File save completed {sd.FileName}");
}
else UTIL.MsgE("No image");
PUB.mre[camidx].Set();
}
else PUB.log_[logIdx].AddE($"Image is locked");
}
private void toolStripButton11_Click_1(object sender, EventArgs e)
{
var bt = sender as ToolStripButton;
var tagstr = bt.Tag.ToString();
OpenFileDialog od = new OpenFileDialog();
od.Filter = "image file|*.jpg;*.bmp";
od.FilterIndex = 0;
if (od.ShowDialog() != DialogResult.OK) return;
//Turn off live mode
var camIdx = tagstr == "L" ? PUB.setting.CameraIndexL : PUB.setting.CameraIndexR;
var logIdx = camIdx == PUB.setting.CameraIndexL ? 0 : 1;
PUB.IsLive[camIdx] = false;
//iv[camidx].Image = null;
//Remove existing image
if (PUB.mre[camIdx].WaitOne(100))
{
PUB.mre[camIdx].Reset();
if (PUB.OrgImage[camIdx] != null) PUB.OrgImage[camIdx].Dispose();
PUB.OrgImage[camIdx] = new EImageBW8();
PUB.OrgImage[camIdx].Load(od.FileName);
var target = tagstr == "L" ? eTarget.Left : eTarget.Right;
var pan = target == eTarget.Left ? pivLeft : pIvRight;
//draw image
PUB.DrawImage(target, pan, PUB.OrgImage[camIdx]);
PUB.mre[camIdx].Set();
}
else
{
PUB.log_[logIdx].AddE($"Cannot execute because image is locked");
return;
}
}
private void toolStripButton12_Click_1(object sender, EventArgs e)
{
//ivL.ZoomFit();
}
private void toolStripButton3_Click_1(object sender, EventArgs e)
{
// ivL.ZoomIn();
}
private void toolStripButton2_Click_1(object sender, EventArgs e)
{
//ivL.ZoomOut();
}
private void toolStripButton13_Click(object sender, EventArgs e)
{
// this.ivL.DebugMode = !this.ivL.DebugMode;
// this.ivL.Invalidate();
}
List<Util_Vision.SCodeData>[] coderesult = new List<Util_Vision.SCodeData>[] {
new List<Util_Vision.SCodeData>(),
new List<Util_Vision.SCodeData>()
};
private void toolStripMenuItem7_Click(object sender, EventArgs e)
{
var bt = sender as ToolStripMenuItem;
var tagstr = bt.Tag.ToString();
var camIdx = tagstr == "L" ? PUB.setting.CameraIndexL : PUB.setting.CameraIndexR;
var target = PUB.GetTarget(camIdx);// tagstr == "L" ? eTarget.Left : eTarget.Right;
var logIdx = target == eTarget.Left ? 0 : 1;
if (target == eTarget.None)
{
UTIL.MsgE("Target not specified");
return;
}
PUB.log_[logIdx].Add("Image Test run");
System.Diagnostics.Stopwatch wat = new Stopwatch();
wat.Restart();
if (PUB.mre[camIdx].WaitOne(100))
{
PUB.mre[camIdx].Reset();
var rlt = Util_Vision.DetectQR(PUB.OrgImage[camIdx], null, 0,
out string resultMessage,
PUB.setting.erodevaluestr,
PUB.setting.GainOffsetListStr,
PUB.setting.blob_area_min,
PUB.setting.blob_area_max,
PUB.setting.blob_sigmaxy,
PUB.setting.blob_sigmayy,
PUB.setting.blob_sigmaxx,
PUB.setting.blob_minw,
PUB.setting.blob_maxw,
PUB.setting.blob_minh,
PUB.setting.blob_maxh);
coderesult[camIdx] = rlt.Item1;
PUB.ProcessTime[camIdx] = rlt.Item4;
var pan = target == eTarget.Left ? pivLeft : pIvRight;
PUB.DrawImage(target, pan, PUB.OrgImage[camIdx], rlt.Item1, rlt.Item2, rlt.Item3);
PUB.mre[camIdx].Set();
}
else PUB.log_[logIdx].AddE($"Image is locked");
wat.Stop();
PUB.log_[logIdx].Add($"{wat.ElapsedMilliseconds}ms");
}
private void toolStripMenuItem19_Click(object sender, EventArgs e)
{
var bt = sender as ToolStripMenuItem;
var camIdx = bt.Tag.ToString().Equals("L") ? PUB.setting.CameraIndexL : PUB.setting.CameraIndexR;
var logIdx = camIdx == PUB.setting.CameraIndexL ? 0 : 1;
PUB.log_[logIdx].Add("Image Test run");
if (PUB.mre[camIdx].WaitOne(100) == false)
{
PUB.log_[logIdx].AddE($"Image is locked");
return;
}
PUB.mre[camIdx].Reset();
System.Diagnostics.Stopwatch wat = new Stopwatch();
wat.Restart();
var rlt = Util_Vision.DetectQR(PUB.OrgImage[camIdx], null, 0,
out string resultMessage,
PUB.setting.erodevaluestr,
PUB.setting.GainOffsetListStr,
PUB.setting.blob_area_min,
PUB.setting.blob_area_max,
PUB.setting.blob_sigmaxy,
PUB.setting.blob_sigmayy,
PUB.setting.blob_sigmaxx, PUB.setting.blob_minw,
PUB.setting.blob_maxw,
PUB.setting.blob_minh,
PUB.setting.blob_maxh);
coderesult[camIdx] = rlt.Item1;
PUB.mre[camIdx].Set();
PUB.ProcessTime[camIdx] = rlt.Item4;
Util_Vision.SCodeData codedata;
List<string> data = new List<string>();
Boolean FindAmkorQR = false;
if (coderesult[camIdx].Count > 0)
{
foreach (var item in coderesult[camIdx].OrderByDescending(t => t.sid))
{
//datalist.Add(item.data);
// ptlist.Add(item.corner);
if (FindAmkorQR == false)
{
var bcd = new Class.CAmkorSTDBarcode(item.data);
if (bcd.isValid)
{
codedata = item;
FindAmkorQR = true;
data.Add(item.data);// = item.data;
break;
}
}
}
}
PUB.IsTrigger[camIdx] = true;
if (PUB.setting.SendRawData) //211210
{
if (PUB.BarcodeParsing(camIdx, coderesult[camIdx], "CREVIS"))
PUB.parsetime = DateTime.Now;
else
PUB.parsetime = DateTime.Now.AddMilliseconds(50);
}
else
{
if (PUB.BarcodeParsing(camIdx, data, "CREVIS"))
PUB.parsetime = DateTime.Now;
else
PUB.parsetime = DateTime.Now.AddMilliseconds(50);
}
wat.Stop(); ;
PUB.log_[logIdx].Add($"{wat.ElapsedMilliseconds}ms");
}
private void toolStripMenuItem20_Click(object sender, EventArgs e)
{
if (PUB.setting.CameraIndexL >= 0)
SendStatus(eTarget.Left);
if (PUB.setting.CameraIndexR >= 0)
SendStatus(eTarget.Right);
}
private void toolStripButton21_Click(object sender, EventArgs e)
{
if (PUB.setting.CameraIndexL >= 0)
PUB.IsLive[PUB.setting.CameraIndexL] = !PUB.IsLive[PUB.setting.CameraIndexL];
}
private void btTrigR_Click(object sender, EventArgs e)
{
var but = sender as ToolStripButton;
if (but == null) return;
var camIdx = but.Tag.ToString().Equals("L") ? PUB.setting.CameraIndexL : PUB.setting.CameraIndexR;
var logIdx = camIdx == PUB.setting.CameraIndexL ? 0 : 1;
PUB.triggerTime[camIdx] = DateTime.Now;
PUB.IsTrigger[camIdx] = !PUB.IsTrigger[camIdx];
PUB.lastdata[camIdx] = string.Empty;
PUB.log_[logIdx].Add("User trigger setting value:" + PUB.IsTrigger[camIdx].ToString());
}
private void toolStripButton25_Click(object sender, EventArgs e)
{
var camIdx = PUB.setting.CameraIndexL;
var camTarget = PUB.GetTarget(camIdx);
if (camTarget == eTarget.None) return;
var logIdx = camIdx == PUB.setting.CameraIndexL ? 0 : 1;
PUB.IsProcess[camIdx] = !PUB.IsProcess[camIdx];
PUB.log_[logIdx].Add("Process setting value:" + PUB.IsProcess.ToString());
}
private void btProcessR_Click(object sender, EventArgs e)
{
var bt = sender as ToolStripButton;
var camIdx = bt.Tag.ToString().Equals("L") ? PUB.setting.CameraIndexL : PUB.setting.CameraIndexR;
var logIdx = camIdx == PUB.setting.CameraIndexL ? 0 : 1;
var camTarget = PUB.GetTarget(camIdx);
if (camTarget == eTarget.None)
{
UTIL.MsgE("Target camera not found");
return;
}
PUB.IsProcess[camIdx] = !PUB.IsProcess[camIdx];
PUB.log_[logIdx].Add("Process setting value:" + PUB.IsProcess.ToString());
}
private void btLiveR_Click(object sender, EventArgs e)
{
if (PUB.setting.CameraIndexR >= 0 && PUB.setting.CameraIndexR != PUB.setting.CameraIndexL)
PUB.IsLive[PUB.setting.CameraIndexR] = !PUB.IsLive[PUB.setting.CameraIndexR];
}
private void toolStripButton6_Click_1(object sender, EventArgs e)
{
//Use dummy image
var bt = sender as ToolStripButton;
var camIdx = bt.Tag.ToString().Equals("L") ? PUB.setting.CameraIndexL : PUB.setting.CameraIndexR;
var logIdx = camIdx == PUB.setting.CameraIndexL ? 0 : 1;
if (PUB.mre[camIdx].WaitOne(100))
{
PUB.mre[camIdx].Reset();
var OrgEImage = new EImageBW8(PUB.OrgImage[camIdx].Width, PUB.OrgImage[camIdx].Height);
PUB.OrgImage[camIdx].CopyTo(OrgEImage);
PUB.mre[camIdx].Set();
var f = new fTeach(OrgEImage);
f.TopMost = true;
f.ShowDialog();
OrgEImage.Dispose();
}
else PUB.log_[logIdx].AddE($"Image is locked");
}
private void pIvRight_MouseClick(object sender, MouseEventArgs e)
{
var f = new fviewer(PUB.setting.CameraIndexR);
f.ShowDialog();
}
private void pivLeft_MouseClick(object sender, MouseEventArgs e)
{
var f = new fviewer(PUB.setting.CameraIndexL);
f.ShowDialog();
}
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net47" />
</packages>