private void SetInfoFunction(UPS_SetInfo_enum SetInfoEnum, byte[] Data, FunctionCode functioncode, short RegisterLen = 1) { CommDeviceModbuseControlEntity SetDeviceInfo = new CommDeviceModbuseControlEntity(); SetDeviceInfo.SetData = Data; SetDeviceInfo.SetInfoStartAdr = (short)SetInfoEnum; SetDeviceInfo.functioncode = functioncode; SetDeviceInfo.RegisterLen = RegisterLen; if (SetInfoDelegate != null) { //你确定要设置当前选择命令吗? if (XtraMessageBox.Show(Model_Data.Language.EaSolar.AreYouSureConfig, Model_Data.Language.EaSolar.Prompt, MessageBoxButtons.OKCancel) == DialogResult.OK) { SetInfoDelegate.Invoke(SetDeviceInfo); } } else { DevExpress.XtraEditors.XtraMessageBox.Show(Model_Data.Language.EaSolar.SetFailure + "(BaseSetInfoPanel.SetInfoDelegate=null)"); } }
private void SetInfoFunction(UPS_SetInfo_enum SetInfoEnum, byte[] Data, FunctionCode functioncode, short RegisterLen = 1) { CommDeviceModbuseControlEntity SetDeviceInfo = new CommDeviceModbuseControlEntity(); SetDeviceInfo.SetData = Data; SetDeviceInfo.SetInfoStartAdr = (short)SetInfoEnum; SetDeviceInfo.functioncode = functioncode; SetDeviceInfo.RegisterLen = RegisterLen; if (SetInfoDelegate != null) { //你确定要设置当前选择命令吗? if (XtraMessageBox.Show(Model_Data.Language.EaSolar.AreYouSureConfig, Model_Data.Language.EaSolar.Prompt, MessageBoxButtons.OKCancel) == DialogResult.OK) { //启用一个异步方法去发送命令,防止发送命令的等待(等待解锁或者发生死锁) SetInfoDelegate.Invoke(SetDeviceInfo); //AsyncCallback acl=new AsyncCallback(callback); //SetInfoDelegate.BeginInvoke(SetDeviceInfo, acl, null); } } else { MessageBox.Show("no bind function--idbk"); } }