initial commit
This commit is contained in:
577
Cs_HMI/TestProject/Test_ProPLC/Form1.Designer.cs
generated
Normal file
577
Cs_HMI/TestProject/Test_ProPLC/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,577 @@
|
||||
namespace Test_ProPLC
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <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 Windows Form 디자이너에서 생성한 코드
|
||||
|
||||
/// <summary>
|
||||
/// 디자이너 지원에 필요한 메서드입니다.
|
||||
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
arFrame.Control.ColorListItem colorListItem1 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem2 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem3 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem4 = new arFrame.Control.ColorListItem();
|
||||
this.serialPort1 = new System.IO.Ports.SerialPort(this.components);
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
||||
this.textbox1 = new System.Windows.Forms.ComboBox();
|
||||
this.textbox2 = new System.Windows.Forms.ComboBox();
|
||||
this.gv1 = new arFrame.Control.GridView();
|
||||
this.gv2 = new arFrame.Control.GridView();
|
||||
this.logSub = new arCtl.LogTextBox();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.logMain = new arCtl.LogTextBox();
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.button7 = new System.Windows.Forms.Button();
|
||||
this.button8 = new System.Windows.Forms.Button();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button11 = new System.Windows.Forms.Button();
|
||||
this.button12 = new System.Windows.Forms.Button();
|
||||
this.button13 = new System.Windows.Forms.Button();
|
||||
this.button14 = new System.Windows.Forms.Button();
|
||||
this.button15 = new System.Windows.Forms.Button();
|
||||
this.button16 = new System.Windows.Forms.Button();
|
||||
this.button17 = new System.Windows.Forms.Button();
|
||||
this.button18 = new System.Windows.Forms.Button();
|
||||
this.button19 = new System.Windows.Forms.Button();
|
||||
this.button20 = new System.Windows.Forms.Button();
|
||||
this.button21 = new System.Windows.Forms.Button();
|
||||
this.button22 = new System.Windows.Forms.Button();
|
||||
this.button23 = new System.Windows.Forms.Button();
|
||||
this.button24 = new System.Windows.Forms.Button();
|
||||
this.button35 = new System.Windows.Forms.Button();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(9, 10);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(108, 36);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Conn";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(9, 333);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(108, 36);
|
||||
this.button2.TabIndex = 4;
|
||||
this.button2.Text = "Conn";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(123, 10);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(843, 21);
|
||||
this.textBox3.TabIndex = 6;
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.Location = new System.Drawing.Point(123, 333);
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.Size = new System.Drawing.Size(843, 21);
|
||||
this.textBox4.TabIndex = 7;
|
||||
//
|
||||
// textbox1
|
||||
//
|
||||
this.textbox1.FormattingEnabled = true;
|
||||
this.textbox1.Location = new System.Drawing.Point(9, 52);
|
||||
this.textbox1.Name = "textbox1";
|
||||
this.textbox1.Size = new System.Drawing.Size(108, 20);
|
||||
this.textbox1.TabIndex = 8;
|
||||
//
|
||||
// textbox2
|
||||
//
|
||||
this.textbox2.FormattingEnabled = true;
|
||||
this.textbox2.Location = new System.Drawing.Point(9, 375);
|
||||
this.textbox2.Name = "textbox2";
|
||||
this.textbox2.Size = new System.Drawing.Size(108, 20);
|
||||
this.textbox2.TabIndex = 9;
|
||||
this.textbox2.Text = "COM31";
|
||||
//
|
||||
// gv1
|
||||
//
|
||||
this.gv1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
|
||||
this.gv1.BorderSize = 1;
|
||||
colorListItem1.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
|
||||
colorListItem1.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
|
||||
colorListItem1.Remark = "";
|
||||
colorListItem2.BackColor1 = System.Drawing.Color.Orange;
|
||||
colorListItem2.BackColor2 = System.Drawing.Color.DarkOrange;
|
||||
colorListItem2.Remark = "";
|
||||
this.gv1.ColorList = new arFrame.Control.ColorListItem[] {
|
||||
colorListItem1,
|
||||
colorListItem2};
|
||||
this.gv1.Cursor = System.Windows.Forms.Cursors.Arrow;
|
||||
this.gv1.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.gv1.FontPin = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold);
|
||||
this.gv1.ForeColor = System.Drawing.Color.White;
|
||||
this.gv1.ForeColorPin = System.Drawing.Color.WhiteSmoke;
|
||||
this.gv1.Location = new System.Drawing.Point(123, 37);
|
||||
this.gv1.MatrixSize = new System.Drawing.Point(8, 4);
|
||||
this.gv1.MenuBorderSize = 1;
|
||||
this.gv1.MenuGap = 5;
|
||||
this.gv1.MinimumSize = new System.Drawing.Size(100, 50);
|
||||
this.gv1.Name = "gv1";
|
||||
this.gv1.Names = null;
|
||||
this.gv1.ShadowColor = System.Drawing.Color.Black;
|
||||
this.gv1.showDebugInfo = false;
|
||||
this.gv1.ShowIndexString = true;
|
||||
this.gv1.Size = new System.Drawing.Size(592, 169);
|
||||
this.gv1.TabIndex = 10;
|
||||
this.gv1.Tags = null;
|
||||
this.gv1.Text = "gridView1";
|
||||
this.gv1.TextAttachToImage = true;
|
||||
this.gv1.Titles = null;
|
||||
this.gv1.Values = null;
|
||||
this.gv1.ItemClick += new System.EventHandler<arFrame.Control.GridView.ItemClickEventArgs>(this.gv1_ItemClick);
|
||||
//
|
||||
// gv2
|
||||
//
|
||||
this.gv2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
|
||||
this.gv2.BorderSize = 1;
|
||||
colorListItem3.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
|
||||
colorListItem3.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
|
||||
colorListItem3.Remark = "";
|
||||
colorListItem4.BackColor1 = System.Drawing.Color.Orange;
|
||||
colorListItem4.BackColor2 = System.Drawing.Color.DarkOrange;
|
||||
colorListItem4.Remark = "";
|
||||
this.gv2.ColorList = new arFrame.Control.ColorListItem[] {
|
||||
colorListItem3,
|
||||
colorListItem4};
|
||||
this.gv2.Cursor = System.Windows.Forms.Cursors.Arrow;
|
||||
this.gv2.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.gv2.FontPin = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold);
|
||||
this.gv2.ForeColor = System.Drawing.Color.White;
|
||||
this.gv2.ForeColorPin = System.Drawing.Color.WhiteSmoke;
|
||||
this.gv2.Location = new System.Drawing.Point(123, 360);
|
||||
this.gv2.MatrixSize = new System.Drawing.Point(8, 4);
|
||||
this.gv2.MenuBorderSize = 1;
|
||||
this.gv2.MenuGap = 5;
|
||||
this.gv2.MinimumSize = new System.Drawing.Size(100, 50);
|
||||
this.gv2.Name = "gv2";
|
||||
this.gv2.Names = null;
|
||||
this.gv2.ShadowColor = System.Drawing.Color.Black;
|
||||
this.gv2.showDebugInfo = false;
|
||||
this.gv2.ShowIndexString = true;
|
||||
this.gv2.Size = new System.Drawing.Size(592, 169);
|
||||
this.gv2.TabIndex = 11;
|
||||
this.gv2.Tags = null;
|
||||
this.gv2.Text = "gridView1";
|
||||
this.gv2.TextAttachToImage = true;
|
||||
this.gv2.Titles = null;
|
||||
this.gv2.Values = null;
|
||||
this.gv2.ItemClick += new System.EventHandler<arFrame.Control.GridView.ItemClickEventArgs>(this.gv2_ItemClick);
|
||||
//
|
||||
// logSub
|
||||
//
|
||||
this.logSub.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24)))));
|
||||
this.logSub.ColorList = new arCtl.sLogMessageColor[0];
|
||||
this.logSub.DateFormat = "yy-MM-dd HH:mm:ss";
|
||||
this.logSub.DefaultColor = System.Drawing.Color.LightGray;
|
||||
this.logSub.EnableDisplayTimer = true;
|
||||
this.logSub.EnableGubunColor = true;
|
||||
this.logSub.Font = new System.Drawing.Font("맑은 고딕", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.logSub.ListFormat = "[{0}] {1}";
|
||||
this.logSub.Location = new System.Drawing.Point(123, 535);
|
||||
this.logSub.MaxListCount = ((ushort)(200));
|
||||
this.logSub.MaxTextLength = ((uint)(4000u));
|
||||
this.logSub.MessageInterval = 50;
|
||||
this.logSub.Name = "logSub";
|
||||
this.logSub.Size = new System.Drawing.Size(592, 132);
|
||||
this.logSub.TabIndex = 12;
|
||||
this.logSub.Text = "";
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(721, 360);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(152, 36);
|
||||
this.button3.TabIndex = 13;
|
||||
this.button3.Text = "Z-UP";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(721, 402);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(152, 36);
|
||||
this.button4.TabIndex = 14;
|
||||
this.button4.Text = "Z-STOP";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click);
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Location = new System.Drawing.Point(721, 444);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(152, 36);
|
||||
this.button5.TabIndex = 15;
|
||||
this.button5.Text = "Z-DN";
|
||||
this.button5.UseVisualStyleBackColor = true;
|
||||
this.button5.Click += new System.EventHandler(this.button5_Click);
|
||||
//
|
||||
// logMain
|
||||
//
|
||||
this.logMain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24)))));
|
||||
this.logMain.ColorList = new arCtl.sLogMessageColor[0];
|
||||
this.logMain.DateFormat = "yy-MM-dd HH:mm:ss";
|
||||
this.logMain.DefaultColor = System.Drawing.Color.LightGray;
|
||||
this.logMain.EnableDisplayTimer = true;
|
||||
this.logMain.EnableGubunColor = true;
|
||||
this.logMain.Font = new System.Drawing.Font("맑은 고딕", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.logMain.ListFormat = "[{0}] {1}";
|
||||
this.logMain.Location = new System.Drawing.Point(123, 212);
|
||||
this.logMain.MaxListCount = ((ushort)(200));
|
||||
this.logMain.MaxTextLength = ((uint)(4000u));
|
||||
this.logMain.MessageInterval = 50;
|
||||
this.logMain.Name = "logMain";
|
||||
this.logMain.Size = new System.Drawing.Size(592, 115);
|
||||
this.logMain.TabIndex = 16;
|
||||
this.logMain.Text = "";
|
||||
//
|
||||
// button6
|
||||
//
|
||||
this.button6.BackColor = System.Drawing.Color.Tomato;
|
||||
this.button6.ForeColor = System.Drawing.Color.White;
|
||||
this.button6.Location = new System.Drawing.Point(721, 79);
|
||||
this.button6.Name = "button6";
|
||||
this.button6.Size = new System.Drawing.Size(73, 36);
|
||||
this.button6.TabIndex = 19;
|
||||
this.button6.Text = "L_STOP";
|
||||
this.button6.UseVisualStyleBackColor = false;
|
||||
this.button6.Click += new System.EventHandler(this.button6_Click);
|
||||
//
|
||||
// button7
|
||||
//
|
||||
this.button7.Location = new System.Drawing.Point(721, 121);
|
||||
this.button7.Name = "button7";
|
||||
this.button7.Size = new System.Drawing.Size(73, 36);
|
||||
this.button7.TabIndex = 18;
|
||||
this.button7.Text = "L-DN";
|
||||
this.button7.UseVisualStyleBackColor = true;
|
||||
this.button7.Click += new System.EventHandler(this.button7_Click);
|
||||
//
|
||||
// button8
|
||||
//
|
||||
this.button8.Location = new System.Drawing.Point(721, 37);
|
||||
this.button8.Name = "button8";
|
||||
this.button8.Size = new System.Drawing.Size(73, 36);
|
||||
this.button8.TabIndex = 17;
|
||||
this.button8.Text = "L-UP";
|
||||
this.button8.UseVisualStyleBackColor = true;
|
||||
this.button8.Click += new System.EventHandler(this.button8_Click);
|
||||
//
|
||||
// button9
|
||||
//
|
||||
this.button9.BackColor = System.Drawing.Color.Tomato;
|
||||
this.button9.ForeColor = System.Drawing.Color.White;
|
||||
this.button9.Location = new System.Drawing.Point(800, 78);
|
||||
this.button9.Name = "button9";
|
||||
this.button9.Size = new System.Drawing.Size(73, 36);
|
||||
this.button9.TabIndex = 22;
|
||||
this.button9.Text = "R-STOP";
|
||||
this.button9.UseVisualStyleBackColor = false;
|
||||
this.button9.Click += new System.EventHandler(this.button9_Click);
|
||||
//
|
||||
// button10
|
||||
//
|
||||
this.button10.Location = new System.Drawing.Point(800, 120);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(73, 36);
|
||||
this.button10.TabIndex = 21;
|
||||
this.button10.Text = "R-DN";
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
this.button10.Click += new System.EventHandler(this.button10_Click);
|
||||
//
|
||||
// button11
|
||||
//
|
||||
this.button11.Location = new System.Drawing.Point(800, 36);
|
||||
this.button11.Name = "button11";
|
||||
this.button11.Size = new System.Drawing.Size(73, 36);
|
||||
this.button11.TabIndex = 20;
|
||||
this.button11.Text = "R-UP";
|
||||
this.button11.UseVisualStyleBackColor = true;
|
||||
this.button11.Click += new System.EventHandler(this.button11_Click);
|
||||
//
|
||||
// button12
|
||||
//
|
||||
this.button12.BackColor = System.Drawing.Color.White;
|
||||
this.button12.ForeColor = System.Drawing.Color.Black;
|
||||
this.button12.Location = new System.Drawing.Point(721, 205);
|
||||
this.button12.Name = "button12";
|
||||
this.button12.Size = new System.Drawing.Size(152, 36);
|
||||
this.button12.TabIndex = 25;
|
||||
this.button12.Text = "STOP";
|
||||
this.button12.UseVisualStyleBackColor = false;
|
||||
this.button12.Click += new System.EventHandler(this.button12_Click);
|
||||
//
|
||||
// button13
|
||||
//
|
||||
this.button13.BackColor = System.Drawing.Color.White;
|
||||
this.button13.Location = new System.Drawing.Point(721, 247);
|
||||
this.button13.Name = "button13";
|
||||
this.button13.Size = new System.Drawing.Size(152, 36);
|
||||
this.button13.TabIndex = 24;
|
||||
this.button13.Text = "BACK";
|
||||
this.button13.UseVisualStyleBackColor = false;
|
||||
this.button13.Click += new System.EventHandler(this.button13_Click);
|
||||
//
|
||||
// button14
|
||||
//
|
||||
this.button14.BackColor = System.Drawing.Color.White;
|
||||
this.button14.Location = new System.Drawing.Point(721, 163);
|
||||
this.button14.Name = "button14";
|
||||
this.button14.Size = new System.Drawing.Size(152, 36);
|
||||
this.button14.TabIndex = 23;
|
||||
this.button14.Text = "GO";
|
||||
this.button14.UseVisualStyleBackColor = false;
|
||||
this.button14.Click += new System.EventHandler(this.button14_Click);
|
||||
//
|
||||
// button15
|
||||
//
|
||||
this.button15.Location = new System.Drawing.Point(879, 67);
|
||||
this.button15.Name = "button15";
|
||||
this.button15.Size = new System.Drawing.Size(87, 24);
|
||||
this.button15.TabIndex = 26;
|
||||
this.button15.Text = "10";
|
||||
this.button15.UseVisualStyleBackColor = true;
|
||||
this.button15.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button16
|
||||
//
|
||||
this.button16.Location = new System.Drawing.Point(879, 91);
|
||||
this.button16.Name = "button16";
|
||||
this.button16.Size = new System.Drawing.Size(87, 24);
|
||||
this.button16.TabIndex = 27;
|
||||
this.button16.Text = "20";
|
||||
this.button16.UseVisualStyleBackColor = true;
|
||||
this.button16.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button17
|
||||
//
|
||||
this.button17.Location = new System.Drawing.Point(879, 139);
|
||||
this.button17.Name = "button17";
|
||||
this.button17.Size = new System.Drawing.Size(87, 24);
|
||||
this.button17.TabIndex = 29;
|
||||
this.button17.Text = "40";
|
||||
this.button17.UseVisualStyleBackColor = true;
|
||||
this.button17.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button18
|
||||
//
|
||||
this.button18.Location = new System.Drawing.Point(879, 115);
|
||||
this.button18.Name = "button18";
|
||||
this.button18.Size = new System.Drawing.Size(87, 24);
|
||||
this.button18.TabIndex = 28;
|
||||
this.button18.Text = "30";
|
||||
this.button18.UseVisualStyleBackColor = true;
|
||||
this.button18.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button19
|
||||
//
|
||||
this.button19.Location = new System.Drawing.Point(879, 235);
|
||||
this.button19.Name = "button19";
|
||||
this.button19.Size = new System.Drawing.Size(87, 24);
|
||||
this.button19.TabIndex = 33;
|
||||
this.button19.Text = "80";
|
||||
this.button19.UseVisualStyleBackColor = true;
|
||||
this.button19.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button20
|
||||
//
|
||||
this.button20.Location = new System.Drawing.Point(879, 211);
|
||||
this.button20.Name = "button20";
|
||||
this.button20.Size = new System.Drawing.Size(87, 24);
|
||||
this.button20.TabIndex = 32;
|
||||
this.button20.Text = "70";
|
||||
this.button20.UseVisualStyleBackColor = true;
|
||||
this.button20.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button21
|
||||
//
|
||||
this.button21.Location = new System.Drawing.Point(879, 187);
|
||||
this.button21.Name = "button21";
|
||||
this.button21.Size = new System.Drawing.Size(87, 24);
|
||||
this.button21.TabIndex = 31;
|
||||
this.button21.Text = "60";
|
||||
this.button21.UseVisualStyleBackColor = true;
|
||||
this.button21.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button22
|
||||
//
|
||||
this.button22.Location = new System.Drawing.Point(879, 163);
|
||||
this.button22.Name = "button22";
|
||||
this.button22.Size = new System.Drawing.Size(87, 24);
|
||||
this.button22.TabIndex = 30;
|
||||
this.button22.Text = "50";
|
||||
this.button22.UseVisualStyleBackColor = true;
|
||||
this.button22.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button23
|
||||
//
|
||||
this.button23.Location = new System.Drawing.Point(879, 283);
|
||||
this.button23.Name = "button23";
|
||||
this.button23.Size = new System.Drawing.Size(87, 24);
|
||||
this.button23.TabIndex = 35;
|
||||
this.button23.Text = "100";
|
||||
this.button23.UseVisualStyleBackColor = true;
|
||||
this.button23.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button24
|
||||
//
|
||||
this.button24.Location = new System.Drawing.Point(879, 259);
|
||||
this.button24.Name = "button24";
|
||||
this.button24.Size = new System.Drawing.Size(87, 24);
|
||||
this.button24.TabIndex = 34;
|
||||
this.button24.Text = "90";
|
||||
this.button24.UseVisualStyleBackColor = true;
|
||||
this.button24.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button35
|
||||
//
|
||||
this.button35.Location = new System.Drawing.Point(879, 42);
|
||||
this.button35.Name = "button35";
|
||||
this.button35.Size = new System.Drawing.Size(87, 24);
|
||||
this.button35.TabIndex = 46;
|
||||
this.button35.Text = "0";
|
||||
this.button35.UseVisualStyleBackColor = true;
|
||||
this.button35.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(9, 401);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(108, 20);
|
||||
this.comboBox1.TabIndex = 47;
|
||||
this.comboBox1.Text = "57600";
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Interval = 250;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick_1);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(974, 677);
|
||||
this.Controls.Add(this.comboBox1);
|
||||
this.Controls.Add(this.button35);
|
||||
this.Controls.Add(this.button23);
|
||||
this.Controls.Add(this.button24);
|
||||
this.Controls.Add(this.button19);
|
||||
this.Controls.Add(this.button20);
|
||||
this.Controls.Add(this.button21);
|
||||
this.Controls.Add(this.button22);
|
||||
this.Controls.Add(this.button17);
|
||||
this.Controls.Add(this.button18);
|
||||
this.Controls.Add(this.button16);
|
||||
this.Controls.Add(this.button15);
|
||||
this.Controls.Add(this.button12);
|
||||
this.Controls.Add(this.button13);
|
||||
this.Controls.Add(this.button14);
|
||||
this.Controls.Add(this.button9);
|
||||
this.Controls.Add(this.button10);
|
||||
this.Controls.Add(this.button11);
|
||||
this.Controls.Add(this.button6);
|
||||
this.Controls.Add(this.button7);
|
||||
this.Controls.Add(this.button8);
|
||||
this.Controls.Add(this.logMain);
|
||||
this.Controls.Add(this.button5);
|
||||
this.Controls.Add(this.button4);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.logSub);
|
||||
this.Controls.Add(this.gv2);
|
||||
this.Controls.Add(this.gv1);
|
||||
this.Controls.Add(this.textbox2);
|
||||
this.Controls.Add(this.textbox1);
|
||||
this.Controls.Add(this.textBox4);
|
||||
this.Controls.Add(this.textBox3);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Name = "Form1";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Form1";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.IO.Ports.SerialPort serialPort1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.TextBox textBox3;
|
||||
private System.Windows.Forms.TextBox textBox4;
|
||||
private System.Windows.Forms.ComboBox textbox1;
|
||||
private System.Windows.Forms.ComboBox textbox2;
|
||||
private arFrame.Control.GridView gv1;
|
||||
private arFrame.Control.GridView gv2;
|
||||
private arCtl.LogTextBox logSub;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.Button button5;
|
||||
private arCtl.LogTextBox logMain;
|
||||
private System.Windows.Forms.Button button6;
|
||||
private System.Windows.Forms.Button button7;
|
||||
private System.Windows.Forms.Button button8;
|
||||
private System.Windows.Forms.Button button9;
|
||||
private System.Windows.Forms.Button button10;
|
||||
private System.Windows.Forms.Button button11;
|
||||
private System.Windows.Forms.Button button12;
|
||||
private System.Windows.Forms.Button button13;
|
||||
private System.Windows.Forms.Button button14;
|
||||
private System.Windows.Forms.Button button15;
|
||||
private System.Windows.Forms.Button button16;
|
||||
private System.Windows.Forms.Button button17;
|
||||
private System.Windows.Forms.Button button18;
|
||||
private System.Windows.Forms.Button button19;
|
||||
private System.Windows.Forms.Button button20;
|
||||
private System.Windows.Forms.Button button21;
|
||||
private System.Windows.Forms.Button button22;
|
||||
private System.Windows.Forms.Button button23;
|
||||
private System.Windows.Forms.Button button24;
|
||||
private System.Windows.Forms.Button button35;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
}
|
||||
}
|
||||
|
||||
659
Cs_HMI/TestProject/Test_ProPLC/Form1.cs
Normal file
659
Cs_HMI/TestProject/Test_ProPLC/Form1.cs
Normal file
@@ -0,0 +1,659 @@
|
||||
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 Test_ProPLC
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
arDev.FakePLC dev2;
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.serialPort1.DataReceived += SerialPort1_DataReceived;
|
||||
dev2 = new arDev.FakePLC();
|
||||
this.dev2.ValueChanged += Dev2_ValueChanged;
|
||||
this.dev2.Message += Dev2_Message;
|
||||
this.FormClosed += Form1_FormClosed;
|
||||
}
|
||||
|
||||
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
timer1.Stop();
|
||||
}
|
||||
|
||||
private void Dev2_ValueChanged(object sender, arDev.Arduino.DIO.IOValueEventArgs e)
|
||||
{
|
||||
addMsg2($"val({e.ArrIDX}) -> {e.NewValue}");
|
||||
|
||||
}
|
||||
|
||||
byte[] buffer1;
|
||||
List<byte> Tempbuffer1 = new List<byte>();
|
||||
byte[] buffer2;
|
||||
List<byte> Tempbuffer2 = new List<byte>();
|
||||
|
||||
|
||||
Boolean STX11 = false;
|
||||
Boolean STX21 = false;
|
||||
Boolean ETX11 = false;
|
||||
|
||||
Boolean STX12 = false;
|
||||
Boolean STX22 = false;
|
||||
Boolean ETX12 = false;
|
||||
|
||||
|
||||
//MAIN PLC
|
||||
byte[] DIpinList1 = new byte[] { 22, 23, 24, 25, 26, 27, 28, 29, 41 };
|
||||
string[] DIpinName1 = new string[] { "EMERGENCTY", "OVR_L", "LIDAR_STOP", "LIDAR_SLOW", "OVR_R", "MARK", "GATEOUT_B", "GATEOUT_F", "ALIGN" };
|
||||
|
||||
byte[] DOpinList1 = new byte[] { 33, 34, 35, 36, 37, 43, 44, 39, 40 };
|
||||
string[] DopinName1 = new string[] { "MOT_POWER_GUIDE", "MOT_POWER_L", "MOT_POWER_R", "LIDAR_DIR", "CHARGE_ON", "MOT_DIR_L", "MOT_RUN_L", "MOT_DIR_R", "MOT_RUN_R" };
|
||||
|
||||
|
||||
// SUB PLC
|
||||
byte[] DIpinList2 = new byte[] { 22, 23, 24, 25, 41, 42, 43, 45, 38 };
|
||||
string[] DIpinName2 = new string[] { "BTN_GUIDE_UP", "BTN_GUIDE_DN", "BTN_QA1", "BTN_QC", "LIM_HIGH_R", "LIM_LOW_R", "LIM_HIGH_L", "BTN_PACK", "LIM_LOW_L" };
|
||||
|
||||
|
||||
byte[] DOpinList2 = new byte[] { 30, 31, 32, 33 };
|
||||
string[] DopinName2 = new string[] { "GMOT_INT", "GMOT_DIR", "GMOT_RUN", "GMOT_STA" };
|
||||
|
||||
|
||||
byte LEN1 = 0;
|
||||
byte CHK1 = 0;
|
||||
int bufferCount1 = 0;
|
||||
|
||||
byte LEN2 = 0;
|
||||
byte CHK2 = 0;
|
||||
int bufferCount2 = 0;
|
||||
private void SerialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
|
||||
{
|
||||
bufferCount1 = this.serialPort1.BytesToRead;
|
||||
byte[] rxBuffer = new byte[bufferCount1];
|
||||
serialPort1.Read(rxBuffer, 0, bufferCount1);
|
||||
foreach (byte incomingByte in rxBuffer)
|
||||
{
|
||||
if (STX11 == false)
|
||||
{
|
||||
if (incomingByte != '@')
|
||||
{
|
||||
STX21 = false;
|
||||
ETX11 = false;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
STX11 = true;
|
||||
Tempbuffer1.Add(incomingByte);
|
||||
}
|
||||
}
|
||||
else if (STX21 == false)
|
||||
{
|
||||
if (Tempbuffer1.Count != 1 || Tempbuffer1.Count < 1 || Tempbuffer1[0] != '@' || incomingByte != '@')
|
||||
{
|
||||
STX11 = false;
|
||||
ETX11 = false;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
STX21 = true;
|
||||
Tempbuffer1.Add(incomingByte);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Tempbuffer1.Add(incomingByte);
|
||||
|
||||
//여기서부터는무조건 누적한다.
|
||||
if (Tempbuffer1.Count == 3)
|
||||
{
|
||||
if (Tempbuffer1[0] != 0x40 || Tempbuffer1[1] != '@')
|
||||
{
|
||||
STX11 = false;
|
||||
STX21 = false;
|
||||
ETX11 = false;
|
||||
LEN1 = 0;
|
||||
Tempbuffer1.Clear();
|
||||
}
|
||||
else LEN1 = incomingByte; //데이터 길이가온다
|
||||
}
|
||||
else if (Tempbuffer1.Count == LEN1 + 2 + 1 + 1) //체크섬이 왔다
|
||||
{
|
||||
CHK1 = incomingByte;
|
||||
}
|
||||
else if (Tempbuffer1.Count == LEN1 + 2 + 1 + 1 + 1) //ETX1
|
||||
{
|
||||
if (incomingByte != 0x0D)
|
||||
{
|
||||
//ETX가 와야하는데 다른데이터가 왔다
|
||||
STX11 = false;
|
||||
STX21 = false;
|
||||
ETX11 = false;
|
||||
Console.WriteLine("에러 모두 파기");
|
||||
Tempbuffer1.Clear();
|
||||
}
|
||||
}
|
||||
else if (Tempbuffer1.Count == LEN1 + 2 + 1 + 1 + 1 + 1)
|
||||
{
|
||||
//전체길이를 만족햇다.
|
||||
if (incomingByte != 0x0A)
|
||||
{
|
||||
//ETX가 와야하는데 다른데이터가 왔다
|
||||
STX11 = false;
|
||||
STX21 = false;
|
||||
ETX11 = false;
|
||||
Console.WriteLine("에러 모두 파기");
|
||||
Tempbuffer1.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
STX11 = false;
|
||||
STX21 = false;
|
||||
ETX11 = false;
|
||||
if (buffer1 == null) buffer1 = new byte[Tempbuffer1.Count];
|
||||
else if (buffer1.Length != Tempbuffer1.Count) Array.Resize(ref buffer1, Tempbuffer1.Count);
|
||||
Tempbuffer1.CopyTo(buffer1);
|
||||
Tempbuffer1.Clear();
|
||||
parser(buffer1, tbMsg1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
private void Dev2_Message(object sender, arDev.arRS232.MessageEventArgs e)
|
||||
{
|
||||
addMsg2($"{e.Message}");
|
||||
}
|
||||
|
||||
|
||||
delegate void DisplayMessage(string message);
|
||||
|
||||
void parser(byte[] buffer, Action<string> func, int type)
|
||||
{
|
||||
// DisplayMessage messageTarget;
|
||||
|
||||
var hexString = buffer.GetHexString();
|
||||
var len = buffer[2];
|
||||
if (len + 6 != buffer.Length)
|
||||
{
|
||||
|
||||
func(string.Format("길이오류 예상:{0},수신:{1},{2}", len + 5, buffer.Length, hexString));
|
||||
}
|
||||
else if (buffer[0] != 0x40 || buffer[1] != 0x40 || buffer[buffer.Length - 2] != 0x0D || buffer[buffer.Length - 1] != 0x0A)
|
||||
{
|
||||
func(string.Format("헤더 오류 : {0}", hexString));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var cmd = buffer[3];
|
||||
if (cmd == 'I') //IOData
|
||||
{
|
||||
if (len != 15)
|
||||
{
|
||||
func("IO수신길이오류:" + DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString);
|
||||
}
|
||||
else
|
||||
{
|
||||
var IOData = BitConverter.ToUInt32(buffer, 4);
|
||||
var An1 = BitConverter.ToUInt16(buffer, 8);
|
||||
var An2 = BitConverter.ToUInt16(buffer, 10);
|
||||
var Ao11 = buffer[12];
|
||||
var Ao12 = buffer[13];
|
||||
var FGData = BitConverter.ToInt32(buffer, 14);
|
||||
|
||||
byte[] buf_iodata = new byte[4];
|
||||
Array.Copy(buffer, 4, buf_iodata, 0, 4);
|
||||
|
||||
var ba = new System.Collections.BitArray(buf_iodata);
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
Boolean val = ba[i];
|
||||
if (val)
|
||||
{
|
||||
|
||||
}
|
||||
if (type == 0) this.gv1.setValue(i, val);
|
||||
else this.gv2.setValue(i, val);
|
||||
}
|
||||
|
||||
|
||||
var binstr = Convert.ToString(IOData, 2).PadLeft(32, '0');
|
||||
string msg = string.Format(DateTime.Now.ToString("mm:ss.fff") + " IO:{0},AN={1:0000},{2:0000},FG={3},AO={4},{5}",
|
||||
binstr, An1, An2, FGData, Ao11, Ao12);
|
||||
func(msg);
|
||||
|
||||
if (type == 0) gv1.Invalidate();
|
||||
else gv2.Invalidate();
|
||||
|
||||
}
|
||||
}
|
||||
else if (cmd == 'T')
|
||||
{
|
||||
Boolean errorMessage = buffer[4] == 1;
|
||||
var message = System.Text.Encoding.Default.GetString(buffer, 5, len - 2);//데이터타입과 에러여부 제거
|
||||
if (type == 0)
|
||||
addMsg1("Rx : " + hexString + ", 메세지: " + message);
|
||||
else
|
||||
addMsg2("Rx : " + hexString + ", 메세지: " + message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == 0)
|
||||
addMsg1(DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString + "\n" + "Data=" + System.Text.Encoding.Default.GetString(buffer));
|
||||
else
|
||||
addMsg2(DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString + "\n" + "Data=" + System.Text.Encoding.Default.GetString(buffer));
|
||||
|
||||
//func();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
//Console.WriteLine("Rx : " + hexString);
|
||||
}
|
||||
void tbMsg1(string m)
|
||||
{
|
||||
if (textBox3.InvokeRequired)
|
||||
{
|
||||
textBox3.BeginInvoke(new Action(() =>
|
||||
{
|
||||
textBox3.Text = (m + "\n");
|
||||
// textBox3.ScrollToCaret();
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
textBox3.Text = (m + "\n");
|
||||
//textBox3.ScrollToCaret();
|
||||
|
||||
}
|
||||
}
|
||||
void tbMsg2(string m)
|
||||
{
|
||||
if (textBox4.InvokeRequired)
|
||||
{
|
||||
textBox4.BeginInvoke(new Action(() =>
|
||||
{
|
||||
textBox4.Text = (m + "\n");
|
||||
// richTextBox2.ScrollToCaret();
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
textBox4.Text = (m + "\n");
|
||||
//richTextBox2.ScrollToCaret();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.dev2.IsOpen)
|
||||
{
|
||||
this.serialPort1.Close();
|
||||
this.button1.BackColor = SystemColors.Control;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (textbox1.Text.isEmpty()) return;
|
||||
this.serialPort1.PortName = textbox1.Text;
|
||||
this.serialPort1.BaudRate = 250000;
|
||||
this.serialPort1.Open();
|
||||
button1.BackColor = Color.Lime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
this.Text = bufferCount1.ToString() + "/" + bufferCount2.ToString();
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (textbox2.Text.isEmpty()) return;
|
||||
if (this.dev2.IsOpen)
|
||||
{
|
||||
this.dev2.Close();
|
||||
this.button2.BackColor = SystemColors.Control;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dev2.PortName = textbox2.Text;
|
||||
this.dev2.BaudRate = int.Parse(comboBox1.Text);
|
||||
this.dev2.Open();
|
||||
button2.BackColor = Color.Lime;
|
||||
// timer1.Start();
|
||||
}
|
||||
addMsg2($"open:{this.dev2.IsOpen}");
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
textbox1.Items.Clear();
|
||||
textbox2.Items.Clear();
|
||||
foreach (var port in System.IO.Ports.SerialPort.GetPortNames())
|
||||
{
|
||||
textbox1.Items.Add(port);
|
||||
textbox2.Items.Add(port);
|
||||
}
|
||||
// textbox1.Text = "COM15";
|
||||
// textbox2.Text = "COM16";
|
||||
|
||||
List<Boolean> values = new List<bool>();
|
||||
for (int i = 0; i < 32; i++)
|
||||
values.Add(false);
|
||||
|
||||
this.gv1.setValue(values.ToArray());
|
||||
this.gv2.setValue(values.ToArray());
|
||||
|
||||
//그리드뷰 값초기화
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
string pinName = i.ToString();
|
||||
|
||||
|
||||
if (i < 16 && i < DIpinName1.Length)
|
||||
pinName = string.Format("[{0}:{2}] {1}", i, DIpinName1[i], DIpinList1[i]);
|
||||
else if (i >= 16 && (i - 16) < DopinName1.Length)
|
||||
pinName = string.Format("[{0}:{2}] {1}", i, DopinName1[i - 16], DOpinList1[i - 16]);
|
||||
|
||||
|
||||
|
||||
this.gv1.setTitle(i, pinName);
|
||||
this.gv1.setValue(i, 0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
string pinName = i.ToString();
|
||||
|
||||
if (i < 16)
|
||||
{
|
||||
var pin = (arDev.FakePLC.DIName)i;
|
||||
pinName = $"[{i}] {pin}";
|
||||
}
|
||||
else
|
||||
{
|
||||
var pin = (arDev.FakePLC.DOName)(i-16);
|
||||
pinName = $"[{i}] {pin}";
|
||||
}
|
||||
|
||||
this.gv2.setTitle(i, pinName);
|
||||
this.gv2.setValue(i, 0);
|
||||
}
|
||||
timer1.Start();
|
||||
|
||||
}
|
||||
|
||||
private void gv1_ItemClick(object sender, arFrame.Control.GridView.ItemClickEventArgs e)
|
||||
{
|
||||
//sub item click
|
||||
if (e.idx < 16)
|
||||
{
|
||||
Util.MsgE("입력은 상태를 변경할 수 없습니다");
|
||||
}
|
||||
else
|
||||
{
|
||||
//이 인덱스에 해당하는 포트번호를 가져왕야함
|
||||
|
||||
var dataIndex = e.idx - 16;
|
||||
if (dataIndex >= 0)
|
||||
{
|
||||
var pinNo = DOpinList1[e.idx - 16];
|
||||
var curVal = gv1.getValue(e.idx);
|
||||
byte newval = (byte)(curVal == 0 ? 1 : 0);
|
||||
|
||||
Sendcommand1(eCommand1.SET_DOUTPUT, pinNo, newval);
|
||||
}
|
||||
else Util.MsgE("해당 주소는 허용되지 않습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
byte makeChecksum(byte[] buffer)
|
||||
{
|
||||
//return 0;
|
||||
byte chk = 0;
|
||||
foreach (var b in buffer)
|
||||
chk = (byte)(chk ^ b);
|
||||
return chk;
|
||||
}
|
||||
|
||||
enum eCommand1 : byte
|
||||
{
|
||||
LOAD = 0, //EEPROM 불러오기
|
||||
SAVE, //EEPROM 저장
|
||||
RESET, //초기화
|
||||
SET_PINMODE, //PINMODE 설정
|
||||
SET_DOUTPUT, //디지털출력설정(포트번호,값[1,0])
|
||||
SET_AOUTPUT, //아날로그출력설정(포트GET_SETTING = 50, 포트번호,값(0~255)
|
||||
GET_SETTING = 50, //셋팅값 요청
|
||||
|
||||
MOT = 100, //p1(0=left,1=right), p2(0=stop,1=pos run,2=neg run)
|
||||
MOVE_GO,
|
||||
MOVE_BACK,
|
||||
MOVE_LEFT,
|
||||
MOVE_RIGHT,
|
||||
MOVE_STOP
|
||||
}
|
||||
|
||||
|
||||
enum eCommand2 : byte
|
||||
{
|
||||
LOAD = 0, //EEPROM 불러오기
|
||||
SAVE, //EEPROM 저장
|
||||
RESET, //초기화
|
||||
SET_PINMODE, //PINMODE 설정
|
||||
SET_DOUTPUT, //디지털출력설정(포트번호,값[1,0])
|
||||
SET_AOUTPUT, //아날로그출력설정(포트번호,값[0~255])
|
||||
GET_SETTING = 50, //셋팅값 요청
|
||||
GUIDE_MOT,
|
||||
SET_GUIDE_SPD = 100,//가이드커버(양쪽) 속도 설정(0~255)
|
||||
}
|
||||
void addMsg1(string m)
|
||||
{
|
||||
if (logMain.InvokeRequired)
|
||||
{
|
||||
logMain.BeginInvoke(new Action(() =>
|
||||
{
|
||||
if (m.IndexOf('\n') != -1) m = m.Replace("\r", "").Replace("\n", "");
|
||||
logMain.AddMsg(m);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m.IndexOf('\n') != -1) m = m.Replace("\r", "").Replace("\n", "");
|
||||
logMain.AddMsg(m);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
void addMsg2(string m)
|
||||
{
|
||||
if (logSub.InvokeRequired)
|
||||
{
|
||||
logSub.BeginInvoke(new Action(() =>
|
||||
{
|
||||
if (m.IndexOf('\n') != -1) m = m.Replace("\r", "").Replace("\n", "");
|
||||
logSub.AddMsg(m);
|
||||
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m.IndexOf('\n') != -1) m = m.Replace("\r", "").Replace("\n", "");
|
||||
logSub.AddMsg(m);
|
||||
}
|
||||
|
||||
}
|
||||
private void gv2_ItemClick(object sender, arFrame.Control.GridView.ItemClickEventArgs e)
|
||||
{
|
||||
//sub item click
|
||||
if (e.idx < 16)
|
||||
{
|
||||
Util.MsgE("입력은 상태를 변경할 수 없습니다");
|
||||
}
|
||||
else
|
||||
{
|
||||
//이 인덱스에 해당하는 포트번호를 가져왕야함
|
||||
|
||||
var dataIndex = e.idx - 16;
|
||||
if (dataIndex >= 0)
|
||||
{
|
||||
var pinNo = DOpinList2[e.idx - 16];
|
||||
var curVal = gv2.getValue(e.idx);
|
||||
byte newval = (byte)(curVal == 0 ? 1 : 0);
|
||||
|
||||
// Sendcommand2(eCommand2.SET_DOUTPUT, pinNo, newval);
|
||||
}
|
||||
else Util.MsgE("해당 주소는 허용되지 않습니다.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Sendcommand1(eCommand1 cmd, byte p1, byte p2)
|
||||
{
|
||||
|
||||
//이번호의 상태를 on/off 해줘야함
|
||||
List<byte> buffer = new List<byte>();
|
||||
|
||||
buffer.Add((byte)cmd); //command
|
||||
buffer.Add(p1);
|
||||
buffer.Add(p2);
|
||||
|
||||
byte dataLen = (byte)buffer.Count; //데이터길이
|
||||
byte checksum = makeChecksum(buffer.ToArray());
|
||||
|
||||
buffer.Insert(0, (byte)'@'); //stx
|
||||
buffer.Insert(1, (byte)'@'); //stx
|
||||
buffer.Insert(2, dataLen);
|
||||
buffer.Add(checksum); //길이를 제외한 실제 데이터 영역만 체크섬
|
||||
buffer.Add(0x0D); //etx
|
||||
buffer.Add(0x0A); //etx
|
||||
|
||||
addMsg1("Tx Buffer : " + buffer.ToArray().GetHexString());
|
||||
|
||||
if (this.serialPort1.IsOpen)
|
||||
serialPort1.Write(buffer.ToArray(), 0, buffer.Count);
|
||||
else
|
||||
addMsg1("포트(2)가 열리지 않았습니다");
|
||||
}
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
//-zup
|
||||
dev2.ZMot(arDev.FakePLC.ZMotDirection.Up);
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
//z-stop
|
||||
dev2.ZMot(arDev.FakePLC.ZMotDirection.Stop);
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
//z-down
|
||||
dev2.ZMot(arDev.FakePLC.ZMotDirection.Down);
|
||||
}
|
||||
|
||||
private void button8_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sendcommand1(eCommand1.MOT, 0, 1);
|
||||
}
|
||||
|
||||
private void button6_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sendcommand1(eCommand1.MOT, 0, 0);
|
||||
}
|
||||
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sendcommand1(eCommand1.MOT, 0, 2);
|
||||
}
|
||||
|
||||
private void button10_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sendcommand1(eCommand1.MOT, 1, 2);
|
||||
}
|
||||
|
||||
private void button9_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sendcommand1(eCommand1.MOT, 1, 0);
|
||||
}
|
||||
|
||||
private void button11_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sendcommand1(eCommand1.MOT, 1, 1);
|
||||
}
|
||||
|
||||
private void button14_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sendcommand1(eCommand1.MOVE_GO, 0, 0);
|
||||
}
|
||||
|
||||
private void button12_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sendcommand1(eCommand1.MOVE_STOP, 0, 0);
|
||||
}
|
||||
|
||||
private void button13_Click(object sender, EventArgs e)
|
||||
{
|
||||
Sendcommand1(eCommand1.MOVE_BACK, 0, 0);
|
||||
}
|
||||
|
||||
private void button15_Click(object sender, EventArgs e)
|
||||
{
|
||||
//지정된 %의 값을 전송한다
|
||||
var but = sender as Button;
|
||||
var percValue = byte.Parse(but.Text.ToString());
|
||||
var realValue = (percValue / 100.0) * 255.0;
|
||||
|
||||
Sendcommand1(eCommand1.SET_AOUTPUT, 11, (byte)realValue);
|
||||
Sendcommand1(eCommand1.SET_AOUTPUT, 12, (byte)realValue);
|
||||
}
|
||||
|
||||
private void button34_Click(object sender, EventArgs e)
|
||||
{
|
||||
//지정된 %의 값을 전송한다
|
||||
var but = sender as Button;
|
||||
var percValue = byte.Parse(but.Text.ToString());
|
||||
var realValue = (percValue / 100.0) * 255.0;
|
||||
|
||||
// Sendcommand2(eCommand2.SET_AOUTPUT, 11, (byte)realValue); //Z축 모터는 동일하게 사용한다
|
||||
}
|
||||
|
||||
private void timer1_Tick_1(object sender, EventArgs e)
|
||||
{
|
||||
timer1.Stop();
|
||||
if (dev2 != null && dev2.IsOpen)
|
||||
{
|
||||
for(byte i = 0; i < 32;i++)
|
||||
{
|
||||
bool v = false;
|
||||
|
||||
if (i < 16) v = dev2.GetValueI(i);
|
||||
else v = dev2.GetValueO((byte)(i-16));
|
||||
|
||||
this.gv2.setValue(i, v);
|
||||
}
|
||||
this.gv2.Invalidate();
|
||||
}
|
||||
|
||||
|
||||
timer1.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
126
Cs_HMI/TestProject/Test_ProPLC/Form1.resx
Normal file
126
Cs_HMI/TestProject/Test_ProPLC/Form1.resx
Normal file
@@ -0,0 +1,126 @@
|
||||
<?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="serialPort1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>95, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>205, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
216
Cs_HMI/TestProject/Test_ProPLC/MethodExtentions.cs
Normal file
216
Cs_HMI/TestProject/Test_ProPLC/MethodExtentions.cs
Normal file
@@ -0,0 +1,216 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Test_ProPLC
|
||||
{
|
||||
/// <summary>
|
||||
/// generic method Extension
|
||||
/// </summary>
|
||||
public static class MethodExtensions
|
||||
{
|
||||
public static string ToString(this System.Drawing.Rectangle rect)
|
||||
{
|
||||
return string.Format("X={0},Y={1},W={2},H={3}", rect.X, rect.Y, rect.Width, rect.Height);
|
||||
}
|
||||
public static string ToString(this System.Drawing.RectangleF rect)
|
||||
{
|
||||
return string.Format("X={0},Y={1},W={2},H={3}", rect.X, rect.Y, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
//public static void SetBGColor(this System.Windows.Forms.Label ctl,System.Drawing.Color color1)
|
||||
//{
|
||||
// ctl.BackColor = System.Drawing.Color.Red;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 0101이 반복되는 문자열 형태로 전환합니다.
|
||||
/// </summary>
|
||||
/// <param name="arr"></param>
|
||||
/// <returns></returns>
|
||||
public static string BitString(this System.Collections.BitArray arr)
|
||||
{
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
for (int i = arr.Length; i > 0; i--)
|
||||
sb.Append(arr[i - 1] ? "1" : "0");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// int 값으로 변환합니다.
|
||||
/// </summary>
|
||||
/// <param name="arr"></param>
|
||||
/// <returns></returns>
|
||||
public static int ValueI(this System.Collections.BitArray arr)
|
||||
{
|
||||
byte[] buf = new byte[4];
|
||||
arr.CopyTo(buf, 0);
|
||||
return BitConverter.ToInt32(buf, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 숫자인지 검사합니다.
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsNumeric(this string input)
|
||||
{
|
||||
double data;
|
||||
return double.TryParse(input, out data);
|
||||
//return Regex.IsMatch(input, @"^\d+$");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// isnullorempty 를 수행합니다.
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public static Boolean isEmpty(this string input)
|
||||
{
|
||||
return string.IsNullOrEmpty(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default 인코딩을 사용하여 문자열로 반환합니다.
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetString(this Byte[] input)
|
||||
{
|
||||
return System.Text.Encoding.Default.GetString(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 16진수 문자열 형태로 반환합니다.
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetHexString(this Byte[] input)
|
||||
{
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
foreach (byte b in input)
|
||||
sb.Append(" " + b.ToString("X2"));
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string Base64Encode(this string src)
|
||||
{
|
||||
string base64enc = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(src));
|
||||
return base64enc;
|
||||
}
|
||||
public static string Base64Decode(this string src)
|
||||
{
|
||||
var base64dec = Convert.FromBase64String(src);
|
||||
return System.Text.Encoding.UTF8.GetString(base64dec);
|
||||
}
|
||||
public static string UrlPathEncode(this string src)
|
||||
{
|
||||
string data = System.Web.HttpUtility.UrlPathEncode(src);
|
||||
return data;
|
||||
}
|
||||
public static string UrlEncode(this string src)
|
||||
{
|
||||
string data = System.Web.HttpUtility.UrlEncode(src, System.Text.Encoding.UTF8);
|
||||
return data;
|
||||
}
|
||||
public static string UrlDecode(this string src)
|
||||
{
|
||||
string data = System.Web.HttpUtility.UrlDecode(src, System.Text.Encoding.UTF8);
|
||||
return data;
|
||||
}
|
||||
public static string toSizeStr(this Size rect)
|
||||
{
|
||||
return string.Format("{0};{1}", rect.Width, rect.Height);
|
||||
}
|
||||
public static string toPointStr(this PointF rect)
|
||||
{
|
||||
return string.Format("{0};{1}", rect.X, rect.Y);
|
||||
}
|
||||
public static string toPointStr(this Point rect)
|
||||
{
|
||||
return string.Format("{0};{1}", rect.X, rect.Y);
|
||||
}
|
||||
public static string toRectStr(this Rectangle rect)
|
||||
{
|
||||
return string.Format("{0};{1};{2};{3}", rect.X, rect.Top, rect.Width, rect.Height);
|
||||
}
|
||||
public static string toRectStr(this RectangleF rect)
|
||||
{
|
||||
return string.Format("{0};{1};{2};{3}", rect.X, rect.Top, rect.Width, rect.Height);
|
||||
}
|
||||
public static RectangleF toRectF(this string str)
|
||||
{
|
||||
var buffer = str.Split(';');
|
||||
if (buffer.Length != 4) return RectangleF.Empty;
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
if (buffer[i] == "") buffer[i] = "0";
|
||||
return new RectangleF(float.Parse(buffer[0]), float.Parse(buffer[1]), float.Parse(buffer[2]), float.Parse(buffer[3]));
|
||||
}
|
||||
public static Rectangle toRect(this string str)
|
||||
{
|
||||
var buffer = str.Split(';');
|
||||
if (buffer.Length != 4) return Rectangle.Empty;
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
if (buffer[i] == "") buffer[i] = "0";
|
||||
return new Rectangle(int.Parse(buffer[0]), int.Parse(buffer[1]), int.Parse(buffer[2]), int.Parse(buffer[3]));
|
||||
}
|
||||
public static Point toPoint(this string str)
|
||||
{
|
||||
str = str.Replace(",", ";").Replace("*", ";").Replace("x", ";").Replace(":", ";");
|
||||
|
||||
var buffer = str.Split(';');
|
||||
if (buffer.Length != 2) return Point.Empty;
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
if (buffer[i] == "") buffer[i] = "0";
|
||||
return new Point(int.Parse(buffer[0]), int.Parse(buffer[1]));
|
||||
}
|
||||
public static Size toSize(this string str)
|
||||
{
|
||||
str = str.Replace(",", ";").Replace("*", ";").Replace("x", ";").Replace(":", ";");
|
||||
|
||||
var buffer = str.Split(';');
|
||||
if (buffer.Length != 2) return Size.Empty;
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
if (buffer[i] == "") buffer[i] = "0";
|
||||
return new Size(int.Parse(buffer[0]), int.Parse(buffer[1]));
|
||||
}
|
||||
public static PointF toPointF(this string str)
|
||||
{
|
||||
str = str.Replace(",", ";").Replace("*", ";").Replace("x", ";").Replace(":", ";");
|
||||
|
||||
var buffer = str.Split(';');
|
||||
if (buffer.Length != 2) return PointF.Empty;
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
if (buffer[i] == "") buffer[i] = "0";
|
||||
return new PointF(float.Parse(buffer[0]), float.Parse(buffer[1]));
|
||||
}
|
||||
public static Rectangle Fix(this Rectangle rect, Size imgsize)
|
||||
{
|
||||
//영역보정
|
||||
if (rect.Left < 1) rect.X = 1;
|
||||
if (rect.Top < 1) rect.Y = 1;
|
||||
if (rect.Right > imgsize.Width) rect.Width = imgsize.Width - rect.Left - 1;
|
||||
if (rect.Bottom > imgsize.Height) rect.Height = imgsize.Height - rect.Top - 1;
|
||||
if (rect.Width < 2 || rect.Height < 2) rect = Rectangle.Empty;
|
||||
return rect;
|
||||
}
|
||||
public static RectangleF FixRoi(this RectangleF rect, Size imgsize)
|
||||
{
|
||||
//영역보정
|
||||
if (rect.Left < 1) rect.X = 1;
|
||||
if (rect.Top < 1) rect.Y = 1;
|
||||
if (rect.Right > imgsize.Width) rect.Width = imgsize.Width - rect.Left - 1;
|
||||
if (rect.Bottom > imgsize.Height) rect.Height = imgsize.Height - rect.Top - 1;
|
||||
if (rect.Width < 2 || rect.Height < 2) rect = Rectangle.Empty;
|
||||
return rect;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
21
Cs_HMI/TestProject/Test_ProPLC/Program.cs
Normal file
21
Cs_HMI/TestProject/Test_ProPLC/Program.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Test_ProPLC
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 해당 응용 프로그램의 주 진입점입니다.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Cs_HMI/TestProject/Test_ProPLC/Properties/AssemblyInfo.cs
Normal file
36
Cs_HMI/TestProject/Test_ProPLC/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
|
||||
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이러한 특성 값을 변경하세요.
|
||||
[assembly: AssemblyTitle("Test_ProPLC")]
|
||||
[assembly: AssemblyDescription("Test_ProPLC")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("ATKEE1")]
|
||||
[assembly: AssemblyProduct("Test_ProPLC")]
|
||||
[assembly: AssemblyCopyright("Copyright ©ATK4 2020")]
|
||||
[assembly: AssemblyTrademark("ATK4")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("9c027bf1-289f-4cc8-83f0-cb2b975c39c2")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("20.03.05.1100")]
|
||||
[assembly: AssemblyFileVersion("20.03.05.1100")]
|
||||
63
Cs_HMI/TestProject/Test_ProPLC/Properties/Resources.Designer.cs
generated
Normal file
63
Cs_HMI/TestProject/Test_ProPLC/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 도구를 사용하여 생성되었습니다.
|
||||
// 런타임 버전:4.0.30319.42000
|
||||
//
|
||||
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
|
||||
// 이러한 변경 내용이 손실됩니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Test_ProPLC.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
|
||||
/// </summary>
|
||||
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
|
||||
// 클래스에서 자동으로 생성되었습니다.
|
||||
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
|
||||
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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("Test_ProPLC.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
Cs_HMI/TestProject/Test_ProPLC/Properties/Resources.resx
Normal file
117
Cs_HMI/TestProject/Test_ProPLC/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?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.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: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" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</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" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
Cs_HMI/TestProject/Test_ProPLC/Properties/Settings.Designer.cs
generated
Normal file
26
Cs_HMI/TestProject/Test_ProPLC/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 도구를 사용하여 생성되었습니다.
|
||||
// 런타임 버전:4.0.30319.42000
|
||||
//
|
||||
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
|
||||
// 이러한 변경 내용이 손실됩니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Test_ProPLC.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
104
Cs_HMI/TestProject/Test_ProPLC/Test_PLC.csproj
Normal file
104
Cs_HMI/TestProject/Test_ProPLC/Test_PLC.csproj
Normal file
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.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>{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Test_ProPLC</RootNamespace>
|
||||
<AssemblyName>Test_ProPLC</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="arControl.Net4">
|
||||
<HintPath>..\Sub\arCtl\bin\debug\arControl.Net4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Web" />
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MethodExtentions.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Util.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.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="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>
|
||||
<ProjectReference Include="..\..\SubProject\arFrameControl\arFrameControl.csproj">
|
||||
<Project>{a16c9667-5241-4313-888e-548375f85d29}</Project>
|
||||
<Name>arFrameControl</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SubProject\CommData\CommData.csproj">
|
||||
<Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project>
|
||||
<Name>CommData</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SubProject\ProPLC\PLC.Net45.csproj">
|
||||
<Project>{476c8e64-7b6b-4554-aca2-04302715750f}</Project>
|
||||
<Name>PLC.Net45</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
461
Cs_HMI/TestProject/Test_ProPLC/Util.cs
Normal file
461
Cs_HMI/TestProject/Test_ProPLC/Util.cs
Normal file
@@ -0,0 +1,461 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Test_ProPLC
|
||||
{
|
||||
public static class Util
|
||||
{
|
||||
#region "MessageBox"
|
||||
public static void MsgI(string m, Boolean legacy = false)
|
||||
{
|
||||
//if(legacy)
|
||||
//{
|
||||
MessageBox.Show(m, "확인", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
//}
|
||||
|
||||
}
|
||||
public static void MsgE(string m, Boolean legacy = false)
|
||||
{
|
||||
//if(legacy)
|
||||
//{
|
||||
MessageBox.Show(m, "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// var f = new fMessageWindow("오류 알림\n" + m);
|
||||
// f.SetWindowColor(fMessageWindow.EWinColor.Error);
|
||||
// f.btNo.Visible = false;
|
||||
// f.btYes.Text = "확인";
|
||||
// f.EnableUserClose = true;
|
||||
// f.DialogMode = true;
|
||||
// f.ShowDialog();
|
||||
//}
|
||||
}
|
||||
public static DialogResult MsgQ(string m, Boolean legacy = false, string btOK = "확인",string btCancel = "아니오")
|
||||
{
|
||||
//if(legacy)
|
||||
{
|
||||
DialogResult dlg = MessageBox.Show(m, "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
return dlg;
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// var f = new fMessageWindow("선택 알림\n" + m);
|
||||
// f.SetWindowColor(fMessageWindow.EWinColor.Attention);
|
||||
// f.EnableUserClose = true;
|
||||
// f.DialogMode = true;
|
||||
// f.btNo.Text = btCancel;
|
||||
// f.btYes.Text = btOK;
|
||||
// var dlg = f.ShowDialog();
|
||||
// return dlg;
|
||||
//}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static string SelectSerialPort()
|
||||
{
|
||||
var f = new System.Windows.Forms.Form();
|
||||
f.WindowState = System.Windows.Forms.FormWindowState.Normal;
|
||||
f.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
f.Size = new System.Drawing.Size(800, 400);
|
||||
f.MaximizeBox = false;
|
||||
f.MinimizeBox = false;
|
||||
f.Text = "Select Port";
|
||||
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
var lst = new System.Windows.Forms.ListBox();
|
||||
lst.Font = new System.Drawing.Font("Consolas", 15, System.Drawing.FontStyle.Bold);
|
||||
lst.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
lst.DoubleClick += (s1, e1) =>
|
||||
{
|
||||
if (lst.SelectedItem != null) f.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
};
|
||||
using (var searcher = new ManagementObjectSearcher("SELECT * FROM WIN32_SerialPort"))
|
||||
{
|
||||
var portnames = System.IO.Ports.SerialPort.GetPortNames().OrderBy(t => t);
|
||||
var ports = searcher.Get().Cast<ManagementBaseObject>().ToList();
|
||||
foreach (var port in portnames)
|
||||
{
|
||||
var desc = "";
|
||||
var portInfo = ports.Where(t => t["DeviceId"].ToString() == port).FirstOrDefault();
|
||||
if (portInfo != null) desc = portInfo["Caption"].ToString();
|
||||
lst.Items.Add(string.Format("{0} - {1}", port, desc));
|
||||
}
|
||||
}
|
||||
f.Controls.Add(lst);
|
||||
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
var name = lst.SelectedItem.ToString().Split('-');
|
||||
return name[0].Trim();
|
||||
}
|
||||
else return string.Empty;
|
||||
}
|
||||
|
||||
public static void ScreenCaptrue(int _BitmapWidth, int _BitmapHeight, Point ptSouce)
|
||||
{
|
||||
try
|
||||
{
|
||||
Bitmap bitmap = new Bitmap(_BitmapWidth, _BitmapHeight);
|
||||
Graphics _graphic = Graphics.FromImage(bitmap);
|
||||
|
||||
_graphic.CopyFromScreen(ptSouce, new Point(0, 0), new Size(_BitmapWidth, _BitmapHeight));
|
||||
|
||||
string savefile = System.IO.Path.Combine(Util.CurrentPath, "ScreenShot", DateTime.Now.ToString("yyyyMMddHHmmss") + ".png");
|
||||
System.IO.FileInfo grpath = new FileInfo(savefile);
|
||||
if (!grpath.Directory.Exists) grpath.Directory.Create();
|
||||
|
||||
bitmap.Save(grpath.FullName, System.Drawing.Imaging.ImageFormat.Png);
|
||||
Util.MsgI("화면 캡쳐 성공\n" +
|
||||
"위치:" + grpath.Directory.FullName +"\n" +
|
||||
"파일명: " + grpath.Name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.MsgE("화면 캡쳐 실패\n" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
public static void CopyData(System.Data.DataRow drSrc, System.Data.DataRow drDes)
|
||||
{
|
||||
if (drDes == null || drSrc == null) return;
|
||||
foreach (System.Data.DataColumn col in drSrc.Table.Columns)
|
||||
{
|
||||
if (col.ColumnName.ToUpper() == "IDX") continue;
|
||||
drDes[col.ColumnName] = drSrc[col.ColumnName];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 현재실행중인폴더를 반환합니다.
|
||||
/// </summary>
|
||||
public static string CurrentPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppDomain.CurrentDomain.BaseDirectory;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 콤마와 줄바꿈등을 제거합니다.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string ToCSVString(string src)
|
||||
{
|
||||
string retval = src.Replace("\r", "").Replace("\n", "").Replace(",", "");
|
||||
return retval;
|
||||
}
|
||||
|
||||
public static Boolean RunProcess(string file, string arg = "")
|
||||
{
|
||||
var fi = new System.IO.FileInfo(file);
|
||||
if (!fi.Exists)
|
||||
{
|
||||
// Pub.log.AddE("Run Error : " + file);
|
||||
return false;
|
||||
}
|
||||
System.Diagnostics.Process prc = new System.Diagnostics.Process();
|
||||
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo(file);
|
||||
si.Arguments = arg;
|
||||
prc.StartInfo = si;
|
||||
prc.Start();
|
||||
return true;
|
||||
}
|
||||
|
||||
#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>
|
||||
/// 지정된 nic카드가 현재 목록에 존재하는지 확인한다.
|
||||
/// </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>
|
||||
/// Ehternet Card 를 사용안함으로 설정합니다.(관리자권한필요)
|
||||
/// </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>
|
||||
/// 이더넷카드를 사용함으로 설정합니다.
|
||||
/// </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 "watchdog"
|
||||
public static void WatchDog_Run()
|
||||
{
|
||||
System.IO.FileInfo fi = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "WatchCat.exe");
|
||||
if (!fi.Exists) return;
|
||||
var Exist = CheckExistProcess("watchcat");
|
||||
if (Exist) return;
|
||||
RunProcess(fi.FullName);
|
||||
}
|
||||
|
||||
public static Boolean CheckExistProcess(string ProcessName)
|
||||
{
|
||||
foreach (var prc in System.Diagnostics.Process.GetProcesses())
|
||||
{
|
||||
if (prc.ProcessName.StartsWith("svchost")) continue;
|
||||
if (prc.ProcessName.ToUpper() == ProcessName.ToUpper()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region "web function"
|
||||
/// <summary>
|
||||
/// 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
|
||||
|
||||
}
|
||||
}
|
||||
3
Cs_HMI/TestProject/Test_ProPLC/app.config
Normal file
3
Cs_HMI/TestProject/Test_ProPLC/app.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
Reference in New Issue
Block a user