Commit ccb3e4a3 authored by wangjunqiang's avatar wangjunqiang

修复com不定和数字键盘bug

parent 0f79d20c
...@@ -31,15 +31,28 @@ namespace GcDevicePc.CK_UI ...@@ -31,15 +31,28 @@ namespace GcDevicePc.CK_UI
{ {
Island = false; Island = false;
} }
if(form!=null)
if (form != null)
{ {
form.Dispose(); form.Close();
if (!form.IsDisposed)
{
form.Dispose();
}
} }
} }
private void button2_Click(object sender, EventArgs e) //放弃 private void button2_Click(object sender, EventArgs e) //放弃
{ {
Island = false; Island = false;
if (form != null)
{
form.Close();
if (!form.IsDisposed)
{
form.Dispose();
}
}
} }
private void LandIn_Load(object sender, EventArgs e) private void LandIn_Load(object sender, EventArgs e)
...@@ -50,7 +63,7 @@ namespace GcDevicePc.CK_UI ...@@ -50,7 +63,7 @@ namespace GcDevicePc.CK_UI
private void textBox2_Click(object sender, EventArgs e) private void textBox2_Click(object sender, EventArgs e)
{ {
form = CKVocAnalyzer.NumForm.GetInstance((TextBox)sender);// new CKVocAnalyzer.NumForm((TextBox)sender); form = CKVocAnalyzer.NumForm.GetInstance((TextBox)sender);// new CKVocAnalyzer.NumForm((TextBox)sender);
form.Icon = this.Icon;
form.Show(); form.Show();
} }
} }
......
...@@ -31,7 +31,7 @@ namespace GcDevicePc.ConfigDlg ...@@ -31,7 +31,7 @@ namespace GcDevicePc.ConfigDlg
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MethodBase)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MethodBase));
this.methodimgList = new System.Windows.Forms.ImageList(this.components); this.methodimgList = new System.Windows.Forms.ImageList();
this.Methodtitle = new System.Windows.Forms.Panel(); this.Methodtitle = new System.Windows.Forms.Panel();
this.mmixbtn = new System.Windows.Forms.Button(); this.mmixbtn = new System.Windows.Forms.Button();
this.mclose = new System.Windows.Forms.Button(); this.mclose = new System.Windows.Forms.Button();
......
...@@ -47,7 +47,12 @@ namespace GcDevicePc.GCBuffer ...@@ -47,7 +47,12 @@ namespace GcDevicePc.GCBuffer
public string ip; public string ip;
public string mask; public string mask;
public string gw; public string gw;
}
public struct OutPutInfo
{
public byte port;
} }
public struct ThreadInfo public struct ThreadInfo
...@@ -62,6 +67,8 @@ namespace GcDevicePc.GCBuffer ...@@ -62,6 +67,8 @@ namespace GcDevicePc.GCBuffer
public WorkInfo pcworkinfo; public WorkInfo pcworkinfo;
public ModuleInfo moduleinfo; public ModuleInfo moduleinfo;
public ThreadInfo pcthreadinfo; public ThreadInfo pcthreadinfo;
public OutPutInfo outputinfo;
} }
public PCInfo gcpcinfo = new PCInfo(); public PCInfo gcpcinfo = new PCInfo();
...@@ -93,6 +100,8 @@ namespace GcDevicePc.GCBuffer ...@@ -93,6 +100,8 @@ namespace GcDevicePc.GCBuffer
gcpcinfo.moduleinfo.ip = ""; gcpcinfo.moduleinfo.ip = "";
gcpcinfo.outputinfo.port = 0;
string file = System.Windows.Forms.Application.StartupPath + "\\startup.ini"; string file = System.Windows.Forms.Application.StartupPath + "\\startup.ini";
...@@ -106,6 +115,9 @@ namespace GcDevicePc.GCBuffer ...@@ -106,6 +115,9 @@ namespace GcDevicePc.GCBuffer
string wtd624x_mask = test.INIGetStringValue("WTD624X", "MASK", null); string wtd624x_mask = test.INIGetStringValue("WTD624X", "MASK", null);
string wtd624x_gw = test.INIGetStringValue("WTD624X", "GW", null); string wtd624x_gw = test.INIGetStringValue("WTD624X", "GW", null);
string gc485 = test.INIGetStringValue("GC485", "COM", null);
//string senddata = test.INIGetStringValue("StartUp", "SendData", null); //string senddata = test.INIGetStringValue("StartUp", "SendData", null);
if (Convert.ToInt32(opensys) == 1) if (Convert.ToInt32(opensys) == 1)
...@@ -127,6 +139,11 @@ namespace GcDevicePc.GCBuffer ...@@ -127,6 +139,11 @@ namespace GcDevicePc.GCBuffer
{ {
gcpcinfo.moduleinfo.gw = wtd624x_gw; gcpcinfo.moduleinfo.gw = wtd624x_gw;
} }
if (!String.IsNullOrEmpty(gc485))
{
gcpcinfo.outputinfo.port = Convert.ToByte(gc485);
}
} }
// gcpcinfo.pcworkinfo.RunType = 0; //运行类型 0 打开运行 1 智能运行 2 批处理 // gcpcinfo.pcworkinfo.RunType = 0; //运行类型 0 打开运行 1 智能运行 2 批处理
......
...@@ -550,8 +550,12 @@ namespace GcDevicePc ...@@ -550,8 +550,12 @@ namespace GcDevicePc
Slavetest = new GCModbusSlave(); Slavetest = new GCModbusSlave();
Slavetest.CModbusSlaveInit(1, 2, 3, 5); Slavetest.CModbusSlaveInit(1, 2, 3, 5);
Slave485test = new GCModbusSlave485(1, 9600); if (globaldata.m_pcbuffer.gcpcinfo.outputinfo.port != 0)
Slave485test.CModbusSlave485Init(1, 2, 3, 5); {
Slave485test = new GCModbusSlave485(globaldata.m_pcbuffer.gcpcinfo.outputinfo.port, 9600);
Slave485test.CModbusSlave485Init(1, 2, 3, 5);
}
} }
catch (Exception e) catch (Exception e)
...@@ -1016,18 +1020,22 @@ namespace GcDevicePc ...@@ -1016,18 +1020,22 @@ namespace GcDevicePc
} }
} }
count = 0; if (globaldata.m_pcbuffer.gcpcinfo.outputinfo.port != 0)
ret = Slave485test.CModbusSlave485Close();
while (ret != 0)
{ {
count++; count = 0;
ret = Slave485test.CModbusSlave485Close(); ret = Slave485test.CModbusSlave485Close();
Thread.Sleep(100); while (ret != 0)
if (count > 3)
{ {
break; count++;
ret = Slave485test.CModbusSlave485Close();
Thread.Sleep(100);
if (count > 3)
{
break;
}
} }
} }
} }
...@@ -1084,18 +1092,22 @@ namespace GcDevicePc ...@@ -1084,18 +1092,22 @@ namespace GcDevicePc
} }
} }
count = 0; if (globaldata.m_pcbuffer.gcpcinfo.outputinfo.port != 0)
ret = Slave485test.CModbusSlave485Close();
while (ret != 0)
{ {
count++; count = 0;
ret = Slave485test.CModbusSlave485Close(); ret = Slave485test.CModbusSlave485Close();
Thread.Sleep(100); while (ret != 0)
if (count > 3)
{ {
break; count++;
ret = Slave485test.CModbusSlave485Close();
Thread.Sleep(100);
if (count > 3)
{
break;
}
} }
} }
} }
......
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