public DiluterCheckError(XmlMsgDiluterCheckError msg) { InitializeComponent(); _msg = msg; string message = _msg.errorPrompt; if (!string.IsNullOrEmpty(message) && message.Contains("too much in diluter")) { message = message.Substring(0, message.Length - "too much in diluter".Length); this.errorPrompt.Text = message + WanTai.Common.Resources.WanTaiResource.DiluterOverflowError; } else { this.errorPrompt.Text = _msg.errorPrompt; } this.ignore.Text = WanTai.Common.Resources.WanTaiResource.Ignore; this.cancel.Text = WanTai.Common.Resources.WanTaiResource.BtnCancel; }
//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 } }