public MsgDetectError(XmlMsgDetectError detectError) { InitializeComponent(); _detectError = detectError; string liquidStatus = _detectError.liquidStatus; DataTable datatable = new DataTable(); datatable.Columns.Add("tip", typeof(int)); datatable.Columns.Add("status", typeof(string)); datatable.Columns.Add("statusChn", typeof(string)); datatable.Columns.Add("volume", typeof(int)); string[] liquidStatus_s = liquidStatus.Split(';'); if (liquidStatus_s.Count() > 0) { foreach (string _liquidStatus in liquidStatus_s) { string[] oneliquidStatus_s = _liquidStatus.Split(','); if (oneliquidStatus_s.Count() != 3) { continue; } System.Data.DataRow dRow = datatable.NewRow(); dRow["tip"] = int.Parse(oneliquidStatus_s[0]); dRow["status"] = oneliquidStatus_s[1]; string status = oneliquidStatus_s[1]; string statusChn = string.Empty; if (!string.IsNullOrEmpty(status) && status.Contains("OK / automatic handling")) { statusChn = WanTai.Common.Resources.WanTaiResource.OKautomatichandling; } else if (!string.IsNullOrEmpty(status) && status.Contains("not enough liquid")) { statusChn = WanTai.Common.Resources.WanTaiResource.NotEnoughLiquid; } else if (!string.IsNullOrEmpty(status) && status.Contains("no liquid")) { statusChn = WanTai.Common.Resources.WanTaiResource.NoLiquid; } dRow["statusChn"] = statusChn; dRow["volume"] = oneliquidStatus_s[2]; datatable.Rows.Add(dRow); } } this.dataGridView1.DataSource = datatable; btnRetryDetect.Text = WanTai.Common.Resources.WanTaiResource.btnRetryDetect; btnMoveZMax.Text = WanTai.Common.Resources.WanTaiResource.btnMoveZMax; btnPipetNothing.Text = WanTai.Common.Resources.WanTaiResource.btnPipetNothing; btnAspAir.Text = WanTai.Common.Resources.WanTaiResource.btnAspAir; btnAbort.Text = WanTai.Common.Resources.WanTaiResource.btnAbort; btnMoveZTravel.Text = WanTai.Common.Resources.WanTaiResource.btnMoveZTravel; }
//Handling event capture from MCS component #region IReceiveMsg Members public void OnMsg(int MsgID, string MsgType, string MsgValue, string MsgGroup, string Sender, string SenderGroup, string Receiver, DateTime Timestamp) { LogInfoController.AddLogInfo(LogInfoLevelEnum.Debug, "Into OnMsg, MsgValue = " + MsgValue, SessionInfo.LoginName, this.GetType().ToString() + "->" + "OnMsg()", SessionInfo.ExperimentID); if (onReceiveError != null) { onReceiveError(); } string m_OriginMsgGUID = ""; // create instance of XmlMsgBase and parse MsgValue content EVOApiErrorMsg.XmlMsgBase msgBase = new EVOApiErrorMsg.XmlMsgBase("", MsgValue); // save MsgGUID for response message (required since EVOApiErrorMessage V2.2.0.2) //m_OriginMsgGUID = msgBase.MsgGUID; System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); xmlDoc.LoadXml(MsgValue); System.Xml.XmlNode node = xmlDoc.SelectSingleNode("/*/Header/MsgID"); if (null != node) { m_OriginMsgGUID = node.InnerText; } //Get Message type in order to create correct message object to access to the error member XmlMsgType msgType; msgType = (XmlMsgType)Enum.Parse(typeof(XmlMsgType), MsgType); switch (msgType) { case (XmlMsgType.MST_DetectError): XmlMsgDetectError msgDetect = new XmlMsgDetectError(MsgValue); msgDetect.ParsingXmlContent(); EVOErrorBox.MsgDetectError detectError = new EVOErrorBox.MsgDetectError(msgDetect); detectError.ShowDialog(); SendRespons(m_OriginMsgGUID, detectError.ErrorResponse); break; //the clot error message has no content case (XmlMsgType.MST_ClotError): XmlMsgClotError msgClotError = new XmlMsgClotError(MsgValue); msgClotError.ParsingXmlContent(); EVOErrorBox.ClotError clotError = new EVOErrorBox.ClotError(msgClotError); clotError.ShowDialog(); SendRespons(m_OriginMsgGUID, clotError.ErrorResponse); break; case (XmlMsgType.MST_DiluterCheckError): XmlMsgDiluterCheckError msg = new XmlMsgDiluterCheckError(MsgValue); msg.ParsingXmlContent(); EVOErrorBox.DiluterCheckError dulterCheckError = new EVOErrorBox.DiluterCheckError(msg); dulterCheckError.ShowDialog(); SendRespons(m_OriginMsgGUID, dulterCheckError.ErrorResponse); break; case (XmlMsgType.MST_DiTiFetchError): XmlMsgDiTiFetchError msgDiTiFetch = new XmlMsgDiTiFetchError(MsgValue); msgDiTiFetch.ParsingXmlContent(); EVOErrorBox.DiTiFetchError diTiFetchError = new EVOErrorBox.DiTiFetchError(msgDiTiFetch); diTiFetchError.ShowDialog(); SendRespons(m_OriginMsgGUID, diTiFetchError.ErrorResponse); break; case (XmlMsgType.MST_DiTiNotMountedError): XmlMsgDiTiNotMountedError msgditiNotMount = new XmlMsgDiTiNotMountedError(MsgValue); msgditiNotMount.ParsingXmlContent(); EVOErrorBox.DiTiNotMountedError ditiNotMount = new EVOErrorBox.DiTiNotMountedError(msgditiNotMount); ditiNotMount.ShowDialog(); SendRespons(m_OriginMsgGUID, ditiNotMount.ErrorResponse); break; case (XmlMsgType.MST_DiTiLostError): XmlMsgDiTiLostError msgditiLost = new XmlMsgDiTiLostError(MsgValue); msgditiLost.ParsingXmlContent(); EVOErrorBox.DiTiLostError ditiLost = new EVOErrorBox.DiTiLostError(msgditiLost); ditiLost.ShowDialog(); SendRespons(m_OriginMsgGUID, ditiLost.ErrorResponse); break; case (XmlMsgType.MST_DiTiMountedError): XmlMsgDiTiMountedError msgDitiMount = new XmlMsgDiTiMountedError(MsgValue); msgDitiMount.ParsingXmlContent(); EVOErrorBox.DiTiMountedError DitiMount = new EVOErrorBox.DiTiMountedError(msgDitiMount); DitiMount.ShowDialog(); SendRespons(m_OriginMsgGUID, DitiMount.ErrorResponse); break; case (XmlMsgType.MST_MessageBox): XmlMsgMessageBox msgMB = new XmlMsgMessageBox(MsgValue); msgMB.ParsingXmlContent(); if (msgMB.errorPrompt.Contains("Evoware switches to offline mode and aborts script")) { EVOOffline = true; if (onOfflineStatus != null) { onOfflineStatus(); } } EVOErrorBox.MsgMessageBox messageBox = new EVOErrorBox.MsgMessageBox(msgMB); messageBox.ShowDialog(); if (msgMB.errorPrompt.Contains("No connection to the instrument")) { if (messageBox.ErrorResponse == ErrorResponseOption.DLG_NO) { EVOOffline = true; if (onOfflineStatus != null) { onOfflineStatus(); } } else { isNoConnection = true; } } SendRespons(m_OriginMsgGUID, messageBox.ErrorResponse); break; case (XmlMsgType.MST_DoorLockError): XmlMsgDoorLockError msgDoorLockError = new XmlMsgDoorLockError(MsgValue); msgDoorLockError.ParsingXmlContent(); EVOErrorBox.DoorLockError doorLockError = new EVOErrorBox.DoorLockError(msgDoorLockError); doorLockError.ShowDialog(); SendRespons(m_OriginMsgGUID, doorLockError.ErrorResponse); break; case (XmlMsgType.MST_GripError): XmlMsgGripError msgGripError = new XmlMsgGripError(MsgValue); msgGripError.ParsingXmlContent(); EVOErrorBox.GripError gripError = new EVOErrorBox.GripError(msgGripError); gripError.ShowDialog(); SendRespons(m_OriginMsgGUID, gripError.ErrorResponse); break; default: SendRespons(m_OriginMsgGUID, ErrorResponseOption.NONE); break; //All other message type here } }