}//reference to calling object public int lShowForm() { mView = new CCollectionView(); int lStatus = mView.lShowForm(); return(lStatus); }
protected virtual void Dispose(bool isDisposing) { if (isDisposing) { //logs the collection termination ProFitData.gFRWKSVC.SysLog("CCollectin::Terminate", LogLevel.logAudit2); //tell framework to release the ClassInfo mClassInfo.lRelease(); //clean up code - dereference all module level collections/arrays/collections if (mClassInfo != null) { mClassInfo.Dispose(); mClassInfo = null; } if (mView != null) { mView.Dispose(); mView = null; } if (mData != null) { mData.Dispose(); mData = null; } if (Parent != null) { Parent = null; } } }
private void Form_Terminate_Renamed() { //Log destruction of Form. ProFitData.gFRWKSVC.SysLog("frmCollectionLetter::Terminate", LogLevel.logAudit2); mParent = null; }
//Before a form disappears, it needs to know who's making it //disappear. If the form is closing on its own, it needs to //notify its Parent View class, so the View can release its //reference. Otherwise, the View already knows and all we //need to do is release our reference to the View. private void frmCollectionLetter_FormClosing(Object eventSender, FormClosingEventArgs eventArgs) { int Cancel = (eventArgs.Cancel) ? 1 : 0; //int UnloadMode = (int) eventArgs.CloseReason; //If the View is shutting us down. if (mbShutDownFromView) { //Release our reference to the View. mParent = null; } else { //Otherwise, //we're shutting ourself down, so we need to let //the View know, so it can release its reference. Parent_Renamed.lReleaseForm(); //Release our reference to the View. mParent = null; } eventArgs.Cancel = Cancel != 0; }
// Purpose: This function creates a new View object and calls its ShowForm method. // Author: N/A - Framework template function // Written: N/A // Modification Log // 001 04/27/1999 JG2596 Added Error handler and SysLog stuff public int lShowView() { //initialize the error handler routine int result = ProFitData.PFT_FAILURE; try { //log entry into ShowView method ProFitData.gFRWKSVC.SysLog("CCollection::lShowView - Entry", LogLevel.logAudit2); //Procedure level variables int lStatus = 0; //Instantiate the View and set its Parent mView = new CCollectionView(); mView.Parent = this; lStatus = mView.lShowForm(); if (lStatus != ProFitData.PFT_SUCCESS) { //log the failure of the ShowForm call ProFitData.gFRWKSVC.SysLog("CCollection::lShowView - mView.lShowForm failed", LogLevel.logDebug3); ProFitData.gFRWKSVC.SysLog("CCollection::lShowView - lStatus: " + lStatus.ToString(), LogLevel.logDebug3); //set return value to status result = lStatus; //send control to error handler return(result); } //log a normal termination ProFitData.gFRWKSVC.SysLog("CCollection::lShowView - Normal Termination", LogLevel.logAudit2); //return a normal termination state return(ProFitData.PFT_SUCCESS); } catch (System.Exception _exception_) { Cerner.Foundations.Logging.ExceptionReporting.ReportException(_exception_); //ensure the function returns error status if (result == ProFitData.PFT_SUCCESS) { result = ProFitData.PFT_FAILURE; } //log abnormal termination ProFitData.gFRWKSVC.SysLog("CCollection::lShowView - Abnormal Termination", LogLevel.logAudit2); return(result); } }
//*** ReleaseView //Called by the View object. Informs this class that the //view is going away, so this class must release its public int ReleaseView() { int result = ProFitData.PFT_FAILURE; //init error handler try { //log entrance ProFitData.gFRWKSVC.SysLog("CCollection::lReleaseView - Entrance", LogLevel.logAudit2); Cerner.ApplicationFramework.ConversionSupport.Utils.ReflectionHelper.Invoke(Parent, "lRemoveFromFolder", new object[] { this }); //log a success ProFitData.gFRWKSVC.SysLog("CStatement::lReleaseView = normal termination", LogLevel.logAudit2); //return success //normal termination return(ProFitData.PFT_SUCCESS); } catch (System.Exception _exception_) { Cerner.Foundations.Logging.ExceptionReporting.ReportException(_exception_); //abnormal termination if (result == ProFitData.PFT_SUCCESS) { result = ProFitData.PFT_FAILURE; } ProFitData.gFRWKSVC.SysLog("CCollection::lReleaseView - Abnormal Termination", LogLevel.logAudit2); return(result); } finally { //cleanup code mView = null; } }
//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); } }