Commit 17765e81 authored by leon.huang's avatar leon.huang

version 1.6.8 解决HMI的绑定问题

parent 8acf0cf6
......@@ -42,7 +42,7 @@ namespace GcDevicePc
this.fid1ver.Text = this.FID1version;
this.fid2ver.Text = this.FID2version;
this.tcdver.Text = this.TCD1version;
this.PCver.Text = this.Hmiversion + "/1.6.7";
this.PCver.Text = this.Hmiversion + "/1.6.8";
}
}
}
......@@ -926,15 +926,15 @@ namespace GcDevicePc
INIOperation test = new INIOperation(file);
string Meshport = test.INIGetStringValue("NetWorkConfig", "网口", null);
if (string.IsNullOrEmpty(Meshport))
{
Meshport = "本地连接";
}
//if (string.IsNullOrEmpty(Meshport))
//{
// Meshport = "本地连接";
//}
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in nics)
{
if (adapter.Name == Meshport)
if (adapter.Name == Meshport || string.IsNullOrEmpty(Meshport))
{
bool pd1 = (adapter.NetworkInterfaceType == NetworkInterfaceType.Ethernet || adapter.NetworkInterfaceType == NetworkInterfaceType.Wireless80211);
if (pd1)
......@@ -988,31 +988,28 @@ namespace GcDevicePc
{
HMISearch mysearch = new HMISearch(globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.hmimac);
int hmicount = 0;
bool ret = false;
// bool ret = false;
string ip;
int conncount = 0;
while (true)
{
ret = mysearch.ThStart();
if (ret)
{
Thread.Sleep(3000);
mysearch.ThStart();
hmicount = mysearch.HMICount();
if (hmicount >= 1)
if (hmicount == 1)
{
ip = (((globaldata.DeviceInfo)(mysearch.myHMIList[0])).IpAddr);
globaldata.connection_ip = ip;
//ip = (((globaldata.DeviceInfo)(mysearch.myHMIList[0])).IpAddr);
//globaldata.connection_ip = ip;
mysearch.ThStop();
break;
}
else if(hmicount > 1)
{
mysearch.ThStop();
conncount++;
break;
}
else
{
mysearch.ReGetHmiIp();
Thread.Sleep(2000);
mysearch.ThStop();
conncount++;
}
......
......@@ -677,7 +677,7 @@ namespace GcDevicePc
/// 1.0.2.3 添加了周期完成后,重新绘图功能
private void timer1_Tick(object sender, EventArgs e)
{
this.Text = String.Format("{0}-1.6.7 {1}", globaldata.AppName,Formstr);
this.Text = String.Format("{0}-1.6.8 {1}", globaldata.AppName,Formstr);
HmiStatus.Text = String.Format("状态:{0}", statestr);
......@@ -1652,8 +1652,12 @@ namespace GcDevicePc
void Common_HeadInfo()
{
string tmpFileName;
tmpFileName = globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName;
if (tmpFileName != null)
{
SetMainFormMethodNameTH(tmpFileName.Substring(tmpFileName.LastIndexOf("\\") + 1));
}
}
......@@ -1661,7 +1665,10 @@ namespace GcDevicePc
{
string tmpFileName;
tmpFileName = globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName;
if (tmpFileName != null)
{
SetMainFormMethodNameTH(tmpFileName.Substring(tmpFileName.LastIndexOf("\\") + 1) + " 单次运行");
}
}
......
This diff is collapsed.
......@@ -34,19 +34,21 @@
this.label2 = new System.Windows.Forms.Label();
this.offlinebth = new System.Windows.Forms.Button();
this.StartFormbgWorker = new System.ComponentModel.BackgroundWorker();
this.BindButton1 = new System.Windows.Forms.Button();
this.HMIMACComboBox1 = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.bgpicture)).BeginInit();
this.SuspendLayout();
//
// bgpicture
//
this.bgpicture.BackColor = System.Drawing.Color.Black;
this.bgpicture.Dock = System.Windows.Forms.DockStyle.Fill;
this.bgpicture.Image = ((System.Drawing.Image)(resources.GetObject("bgpicture.Image")));
this.bgpicture.ImageLocation = "";
this.bgpicture.InitialImage = null;
this.bgpicture.Location = new System.Drawing.Point(0, 0);
this.bgpicture.Location = new System.Drawing.Point(-1, 0);
this.bgpicture.Name = "bgpicture";
this.bgpicture.Size = new System.Drawing.Size(479, 403);
this.bgpicture.Size = new System.Drawing.Size(480, 411);
this.bgpicture.TabIndex = 0;
this.bgpicture.TabStop = false;
this.bgpicture.Paint += new System.Windows.Forms.PaintEventHandler(this.bgpicture_Paint);
......@@ -58,7 +60,7 @@
this.label1.BackColor = System.Drawing.SystemColors.Control;
this.label1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(12, 372);
this.label1.Location = new System.Drawing.Point(12, 358);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(76, 19);
this.label1.TabIndex = 1;
......@@ -70,7 +72,7 @@
this.label2.BackColor = System.Drawing.SystemColors.Control;
this.label2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.ForeColor = System.Drawing.Color.White;
this.label2.Location = new System.Drawing.Point(93, 372);
this.label2.Location = new System.Drawing.Point(102, 359);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(69, 19);
this.label2.TabIndex = 2;
......@@ -78,9 +80,10 @@
//
// offlinebth
//
this.offlinebth.Location = new System.Drawing.Point(392, 368);
this.offlinebth.Font = new System.Drawing.Font("宋体", 14F);
this.offlinebth.Location = new System.Drawing.Point(376, 349);
this.offlinebth.Name = "offlinebth";
this.offlinebth.Size = new System.Drawing.Size(75, 23);
this.offlinebth.Size = new System.Drawing.Size(95, 27);
this.offlinebth.TabIndex = 3;
this.offlinebth.Text = "离线模式";
this.offlinebth.UseVisualStyleBackColor = true;
......@@ -93,16 +96,54 @@
this.StartFormbgWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.StartFormbgWorker_DoWork);
this.StartFormbgWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.StartFormbgWorker_ProgressChanged);
//
// BindButton1
//
this.BindButton1.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control;
this.BindButton1.Font = new System.Drawing.Font("宋体", 14F);
this.BindButton1.Location = new System.Drawing.Point(376, 380);
this.BindButton1.Name = "BindButton1";
this.BindButton1.Size = new System.Drawing.Size(95, 27);
this.BindButton1.TabIndex = 5;
this.BindButton1.Text = "绑定";
this.BindButton1.UseVisualStyleBackColor = true;
this.BindButton1.Visible = false;
this.BindButton1.Click += new System.EventHandler(this.BindButton1_Click);
//
// HMIMACComboBox1
//
this.HMIMACComboBox1.Font = new System.Drawing.Font("宋体", 14F);
this.HMIMACComboBox1.FormattingEnabled = true;
this.HMIMACComboBox1.Location = new System.Drawing.Point(102, 381);
this.HMIMACComboBox1.Name = "HMIMACComboBox1";
this.HMIMACComboBox1.Size = new System.Drawing.Size(193, 27);
this.HMIMACComboBox1.TabIndex = 6;
this.HMIMACComboBox1.Visible = false;
//
// label3
//
this.label3.BackColor = System.Drawing.SystemColors.Control;
this.label3.Font = new System.Drawing.Font("宋体", 14F);
this.label3.ForeColor = System.Drawing.Color.White;
this.label3.Location = new System.Drawing.Point(6, 381);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(90, 30);
this.label3.TabIndex = 7;
this.label3.Visible = false;
//
// StartForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(479, 403);
this.ClientSize = new System.Drawing.Size(479, 414);
this.Controls.Add(this.label3);
this.Controls.Add(this.HMIMACComboBox1);
this.Controls.Add(this.BindButton1);
this.Controls.Add(this.offlinebth);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.bgpicture);
this.ForeColor = System.Drawing.SystemColors.ControlText;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "StartForm";
......@@ -122,5 +163,8 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button offlinebth;
private System.ComponentModel.BackgroundWorker StartFormbgWorker;
private System.Windows.Forms.Button BindButton1;
private System.Windows.Forms.ComboBox HMIMACComboBox1;
private System.Windows.Forms.Label label3;
}
}
\ No newline at end of file
......@@ -23,6 +23,8 @@ namespace GcDevicePc
private static Thread _tPreload;
private MainForm _mMainForm;
private bool bBindOK = false;
private bool BindOK_Enable = false;
#region 窗口淡入淡出效果
private void OpacityTimerProcOpen(object sender, System.Timers.ElapsedEventArgs e)
......@@ -137,8 +139,10 @@ namespace GcDevicePc
StartFormbgWorker.RunWorkerAsync();
//载入时开启预载线程
_tPreload = new Thread(PreLoadingProc);
_tPreload.IsBackground = true;
_tPreload.Start();
}
......@@ -149,7 +153,7 @@ namespace GcDevicePc
private void PreLoadingProc()
{
bool ret = false;
ManualResetEvent ManualResetEvent = new ManualResetEvent(false);
//globaldata.m_appinit.InitAppFolderGC();
_appInitInfo = "系统初始化开始";
_appInitInfo = "检测本地网络";
......@@ -164,11 +168,39 @@ namespace GcDevicePc
{
globaldata.connection_ip = "";
}
else if (dr== DialogResult.Cancel)
else if (dr == DialogResult.Cancel)
{
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
}
else
{
if(globaldata.DeviceList.Count == 1)
{
globaldata.connection_ip = ((globaldata.DeviceInfo)globaldata.DeviceList[0]).IpAddr;
string file = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.StartupPath), "GC_Config\\GC_Set\\启动参数\\startup.ini");
INIOperation test = new INIOperation(file);
test.INIWriteValue(file, "NetWorkConfig", "MAC地址", ((globaldata.DeviceInfo)globaldata.DeviceList[0]).MacAddr);
}
else if (globaldata.DeviceList.Count > 1)
{
_appInitInfo = "获取到多个设备,请选择一个设备进行绑定";
_opacityTimer.Enabled = false;
Invoke(new Action(() =>
{
this.label3.Text = "设备SN号:";
HMIMACComboBox1.Visible = true;
BindButton1.Visible = true;
for (int i = 0; i < globaldata.DeviceList.Count; i++)
{
HMIMACComboBox1.Items.Add(((globaldata.DeviceInfo)globaldata.DeviceList[i]).MacAddr);
}
}));
while (!bBindOK);
}
}
_appInitInfo = "获取设备信息";
globaldata.m_appinit.InitDeviceInfo();
......@@ -203,7 +235,6 @@ namespace GcDevicePc
}
if (worker != null)
worker.ReportProgress(50, _appInitInfo + tail);
Thread.Sleep(500);
}
......@@ -219,5 +250,26 @@ namespace GcDevicePc
{
globaldata.OffLinkMode = true;
}
private void BindButton1_Click(object sender, EventArgs e)
{
try
{
globaldata.connection_ip = ((globaldata.DeviceInfo)globaldata.DeviceList[HMIMACComboBox1.SelectedIndex]).IpAddr;
_opacityTimer.Enabled = true;
bBindOK = true;
this.label3.Text = "";
HMIMACComboBox1.Visible = false;
BindButton1.Visible = false;
string file = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.StartupPath), "GC_Config\\GC_Set\\启动参数\\startup.ini");
INIOperation test = new INIOperation(file);
test.INIWriteValue(file, "NetWorkConfig", "MAC地址", ((globaldata.DeviceInfo)globaldata.DeviceList[HMIMACComboBox1.SelectedIndex]).MacAddr);
}
catch
{
}
}
}
}
......@@ -586,9 +586,12 @@
kVdVf4GZdCH8L3a8zJ/4Cmiks1b7y+hLOIhw6HMWSZeYqubv/wB1fQP/AOA//9k=
</value>
</data>
<data name="StartFormbgWorker.TrayLocation" type="System.Drawing.Point, System.Drawing">
<metadata name="StartFormbgWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</data>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>35</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAMDAAAAEAIACoJQAAFgAAACgAAAAwAAAAYAAAAAEAIAAAAAAAACQAAAAAAAAAAAAAAAAAAAAA
......
This diff is collapsed.
This diff is collapsed.
......@@ -20,10 +20,11 @@ namespace GcDevicePc
public string Netmask;
public string Gateway;
public bool bActive;
public string MasterIP;
};
public static DeviceInfo m_DeviceInfo;
public static ArrayList DeviceList = new ArrayList();
public static List<DeviceInfo> CanSearchDeviceList = new List<DeviceInfo>();
public static bool StartNetwork = false;
public static bool OffLinkMode = false;
......
[NetWorkConfig]
MAC地址=
网口=本地连接
MAC地址=F8:02:78:60:0F:40
网口=
是否只搜索在线=NO
[StartUp]
自启动=0
......@@ -18,7 +19,7 @@ InfoLog=0
ErrLog=0
HmiLog=0
[Version]
VersionType=1
VersionType=0
AppName=大电脑
[User]
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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