//Refer to the CMessage class for details about receiving //messages. This function is vital for receiving special //instructions from the Framework and other classes. It //receives a CMessage object, and optionally returns //a CMessage object. public int Message(PFTFramework.CMessage oMsg) { int result = ProFitData.PFT_FAILURE; //initialize the error handler try { //logs the entry into this method ProFitData.gFRWKSVC.SysLog("CCollection::Message - Entry", LogLevel.logAudit2); int lStatus = 0; //determines what action is required based on the type of message //being sent to this object from the frameworks message services switch (oMsg.MessageType) { case eMessageType.MSG_CREATE: //We can set up any additional info here //if we need too. In this case, we set up //our IconText and PanelText properties. ClassInfo.IconText = ResourceHandler.Resources.GetString("1475"); //i18n ClassInfo.PanelText = ResourceHandler.Resources.GetString("1475"); //i18n //Now we add our icon to the Navigation bar //(optional) ClassInfo.AddIconToNavBar(); lStatus = Convert.ToInt32(Cerner.ApplicationFramework.ConversionSupport.Utils.ReflectionHelper.Invoke(Parent, "lAddIconToTvw", new object[] { mClassInfo })); //This message is sent from the Framework, telling //us that the Framework is being shut down, and we //need to clean up our resources. break; case eMessageType.MSG_DESTROY: if (mView != null) { //we don't have a view, so don't worry about it mView.lShutDownFromParent(); //we can release our view reference mView = null; mClassInfo = null; } //message is sent to tell us that we have been clicked break; case eMessageType.MSG_CLICK: if (mView == null) { //we don't have a view, so make one lStatus = lShowView(); if (lStatus != ProFitData.PFT_SUCCESS) { //Message the user that there has been a problem in creating the form. } } //Activate the form associated with the view mView.lActivateForm(); break; case eMessageType.MSG_NOTIFY: //figure out who is notifying us //TL4790 if (string.Compare(Convert.ToString(oMsg.Variable2), "BESEARCH", true) == 0) { lStatus = mView.lMessageReply(oMsg); if (lStatus != ProFitData.PFT_SUCCESS) { ProFitData.gFRWKSVC.SysLog("Error returned from mView:lMessageReply", LogLevel.logDebug3); ProFitData.gFRWKSVC.SysLog("lRet: " + lStatus.ToString(), LogLevel.logDebug3); } } else { } //End TL4790 break; default: break; } //normal termination ProFitData.gFRWKSVC.SysLog("CCollection::Message - Normal Termination", LogLevel.logAudit2); //returns the normal termination of this method return(ProFitData.PFT_SUCCESS); } catch (System.Exception _exception_) { Cerner.Foundations.Logging.ExceptionReporting.ReportException(_exception_); //ensures the function returns an error status if (result == ProFitData.PFT_SUCCESS) { result = ProFitData.PFT_FAILURE; } //abnormal termination ProFitData.gFRWKSVC.SysLog("CCollection::Message - Abnormal Termination", LogLevel.logAudit2); return(result); } }