public void Init() { saveVarible saveVarible1 = new saveVarible(); SAVE.ReadVar(this.Text, ref saveVarible1); //ipInput1.ipText = saveVarible1.ip; int chaoshi = 0; int max = 4; while (!njCompolet1.IsConnected && chaoshi < max) { Thread.Sleep(1000); if (onLogEvent != null) { onLogEvent(new OnLogEventArgs("LOG:PLC尝试连接" + chaoshi.ToString() + "次!")); } chaoshi++; } if (chaoshi == max) { if (onLogEvent != null) { onLogEvent(new OnLogEventArgs("ERR:PLC连接超时!")); } } else { if (onLogEvent != null) { onLogEvent(new OnLogEventArgs("LOG:PLC初始化成功!")); } OmroPLCvar后电子秤1监测实例.Start(); //开启值扫描实例循环扫描 OmroPLCvar后电子秤2监测实例.Start(); //开启值扫描实例循环扫描 OmroPLCvar前电子秤1监测实例.Start(); //开启值扫描实例循环扫描 OmroPLCvar前电子秤2监测实例.Start(); //开启值扫描实例循环扫描 //OmroPLCvarPLCMFG监测实例.Start(); //开启值扫描实例循环扫描 OmroPLCvarPLC报警监测实例.Start(); //开启值扫描实例循环扫描 //OmroPLCvarPLC心跳监测实例.Start(); //开启值扫描实例循环扫描 OmroPLCvarPLC相机NG和设备启动监测实例.Start(); OmroPLCvarPLC清数据监测实例.Start(); if (设置界面.电芯扫码) { OmroPLCvarPLC扫电芯码监测实例.Start(); } if (设置界面.弹夹扫码) { OmroPLCvarPLC扫弹夹码监测实例.Start(); } } }
private void menuButton1_SelectedChanged(object sender, EventArgs e) { njCompolet1.PeerAddress = ipInput1.ipText; saveVarible saveVarible1 = new saveVarible(); saveVarible1.ip = ipInput1.ipText; SAVE.SaveVar(this.Text, saveVarible1); menuButton1.Selected = false; }
public void Init() { try { saveVarible saveVarible1 = new saveVarible(); SAVE.ReadVar(FName, ref saveVarible1); if (saveVarible1.comboBox1select > comboBox1.Items.Count - 1) { return; } try { comboBox1.SelectedIndex = saveVarible1.comboBox1select; comboBox2.SelectedIndex = saveVarible1.comboBox2select; comboBox3.SelectedIndex = saveVarible1.comboBox3select; comboBox4.SelectedIndex = saveVarible1.comboBox4select; comboBox5.SelectedIndex = saveVarible1.comboBox5select; SetSerialPort(); } catch { this.Invoke(new Action(() => { comboBox1.SelectedIndex = saveVarible1.comboBox1select; comboBox2.SelectedIndex = saveVarible1.comboBox2select; comboBox3.SelectedIndex = saveVarible1.comboBox3select; comboBox4.SelectedIndex = saveVarible1.comboBox4select; comboBox5.SelectedIndex = saveVarible1.comboBox5select; SetSerialPort(); })); } TASKconnect(); } catch (Exception exp) { } }