Commit f043db03 authored by liu's avatar liu

小细节修改

parent 2f1c2e54
This diff is collapsed.
...@@ -199,7 +199,22 @@ namespace GcDevicePc.ProThread ...@@ -199,7 +199,22 @@ namespace GcDevicePc.ProThread
} }
} }
public void testr12(ushort addr, ushort statue)
{
int ret;
int count = 0;
ret = m_modbus.WriteSingleCoil(addr, statue, this.strIP, this.netPost);
while (ret != 0)
{
count++;
ret = m_modbus.WriteSingleCoil(addr, statue, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
/// <summary> /// <summary>
/// 点火 /// 点火
/// </summary> /// </summary>
......
...@@ -12,24 +12,24 @@ namespace GcDevicePc ...@@ -12,24 +12,24 @@ namespace GcDevicePc
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
bool createNew; bool createNew;
Application.Run(new TestForm()); //Application.Run(new TestForm());
{ {
//using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out createNew)) using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out createNew))
//{ {
// if (createNew) if (createNew)
// { {
// Application.Run(new StartForm()); Application.Run(new StartForm());
// mutex.ReleaseMutex(); mutex.ReleaseMutex();
// } }
// else else
// { {
// MessageBox.Show("应用程序已经在运行中..."); MessageBox.Show("应用程序已经在运行中...");
// System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
// Application.Exit(); Application.Exit();
// System.Diagnostics.Process.GetCurrentProcess().Kill(); System.Diagnostics.Process.GetCurrentProcess().Kill();
// // System.Environment.Exit(1); // System.Environment.Exit(1);
// } }
//} }
} }
} }
} }
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
this.gcTitle1 = new GcDevicePc.Controls.GCTitle(); this.gcTitle1 = new GcDevicePc.Controls.GCTitle();
this.button3 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
...@@ -47,7 +49,7 @@ ...@@ -47,7 +49,7 @@
// //
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(250, 364); this.button2.Location = new System.Drawing.Point(241, 318);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23); this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1; this.button2.TabIndex = 1;
...@@ -83,11 +85,27 @@ ...@@ -83,11 +85,27 @@
this.button4.UseVisualStyleBackColor = true; this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.Button4_Click); this.button4.Click += new System.EventHandler(this.Button4_Click);
// //
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(241, 274);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 5;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(357, 274);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 21);
this.textBox2.TabIndex = 5;
//
// TestForm // TestForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 583); this.ClientSize = new System.Drawing.Size(800, 583);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button4); this.Controls.Add(this.button4);
this.Controls.Add(this.button3); this.Controls.Add(this.button3);
this.Controls.Add(this.gcTitle1); this.Controls.Add(this.gcTitle1);
...@@ -96,6 +114,7 @@ ...@@ -96,6 +114,7 @@
this.Name = "TestForm"; this.Name = "TestForm";
this.Text = "TestForm"; this.Text = "TestForm";
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
...@@ -106,5 +125,7 @@ ...@@ -106,5 +125,7 @@
private Controls.GCTitle gcTitle1; private Controls.GCTitle gcTitle1;
private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button4;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
} }
} }
\ No newline at end of file
using GcDevicePc.Common; using GcDevicePc.Common;
using GcDevicePc.ConfigMethod; using GcDevicePc.ConfigMethod;
using GcDevicePc.Controls; using GcDevicePc.Controls;
using GcDevicePc.ProThread;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
...@@ -115,16 +116,20 @@ namespace GcDevicePc ...@@ -115,16 +116,20 @@ namespace GcDevicePc
} }
HMIControl hMI = new HMIControl("172.16.1.58", 502);
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
//MessageBox.Show("asd"); //MessageBox.Show("asd");
//this.pictureMenu1.PMOptbtnstatus = 4; //this.pictureMenu1.PMOptbtnstatus = 4;
//(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 3; //(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 3;
//tinfliang //tinfliang
//LMessageBox box = new LMessageBox(); //LMessageBox box = new LMessageBox();
//box.Show(100, 100, this.Location, true, "1230", "3214", LMessageBox.MessageBoxType.MBT_ButtonOK); //box.Show(100, 100, this.Location, true, "1230", "3214", LMessageBox.MessageBoxType.MBT_ButtonOK);
hMI.testr12(Convert.ToUInt16(textBox1.Text), Convert.ToUInt16(textBox2.Text));
} }
private void Button3_Click(object sender, EventArgs e) private void Button3_Click(object sender, EventArgs e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment