// /////////////////////////////////////////////////////////////////////////////// public void MPBAddEvect(MyMBP m) { m.newTempValue += TempUpdate; m.newRelayValue += RelayUpdate; m.newMPBValue += MPBNew; m.UpdateMPBValue += MPBUpdate; m.newImageValue += ImageUpdate; m.newStateValue += StateUpdate; }
//public MyMBP GetNewMPB(SocketAsyncEventArgs receiveSendEventArgs,/*Socket tcpClient, */string ip, string MAC, uint MPBID, uint relay, uint temp) public MyMBP GetNewMPB(TcpClient tcpClient, string MAC, uint MPBID, uint relay, uint temp) { MyMBP theMPB = new MyMBP(tcpClient, MAC, MPBID, relay, temp); MyForm.MPBAddEvect(theMPB); theMPB.OnNewMPB(); theMPB.ConnectCheck(); //((DataHoldingUserToken)receiveSendEventArgs.UserToken).IsMPBExit.Set(); theMPB.GetMPBState(); return theMPB; }
//private void DisConnectSet(object ip) //{ // string mpbIPADDRESS = (string)ip; // tbMsg.WriteText(mpbIPADDRESS + " 连接断开."); // if (MPBManager.currentMPB.Contains(mpbIPADDRESS)) // { // gbMPB2.None(true); // CloseCurrentLocalConnection(); // } //} //// ----------------------------------------------------------------------------- private void RadioButtonSet(MyMBP m) { uint index = m.Relay; //Rs.ForEach(rb => rb.CheckedChanged -= RadioCheckedChanged); for (int i = 0; i < Rs.Count / 2; i++) { Rs[i * 2].CheckedChanged -= RadioCheckedChanged; if ((index & 0x01) == 0x01) Rs[i * 2].ON(); else Rs[i * 2 + 1].ON(); Rs[i * 2].CheckedChanged += RadioCheckedChanged; index = index >> 0x01; } //Rs.ForEach(rb => rb.CheckedChanged += RadioCheckedChanged); }
private void DisControls(MyMBP mm ,bool b) { if (b) { gbBar1.None(true); tbIP.WriteText("0.0.0.0"); tbMAC.WriteText("00:00:00:00:00:00"); tbTemp.WriteText("0"); Bs.ForEach(bt => bt.None(true)); } else { gbBar1.None(false); tbIP.Text = mm.MPBIPAddress; tbMAC.Text = mm.MAC; tbTemp.Text = String.Format("{0} °C", mm.Temp); RadioButtonSet(mm); Bs.ForEach(bt => bt.None(false)); } }