public void AppDeInit()
        {
            //***************************************************************
            //This Method will be called by SiDiary main application on the
            //termination of your addin. This is the right place for freeing
            //any resources which you've requested on initializing, i.e.
            //deregister events etc.
            //---------------------------------------------------------------
            //aw,  01.06.08: Init
            //***************************************************************

            try
            {
                if ((mfrmAddIn != null))
                {
                    mfrmAddIn.Hide();
                }
                mfrmAddIn = null;

                mAddInObject.EventDeRegister(ISiDiary.genmEvent.All);

                mobjMainApplication = null;
            }

            catch
            {
            }
        }
        public void AppInit(ref object pobjMainApplication, ref bool pbCancel, ref string ptCancelReason)
        {
            //***************************************************************
            //This Method will be called by SiDiary main application on the
            //startup of your addin. Keep a module reference of the given
            //MainApploication object as you will need it to pass calls to
            //SiDiary application
            //If any circumstance occurrs that the AddIn CANNOT be used
            //set pbCancel to True.
            //Valid Main-Menu Index:
            //1-Edit
            //2-Diabetesprofile
            //3-Statistics
            //4-Extras
            //5-Tools
            //File and About-Menues are invalid targets for AddIns
            //---------------------------------------------------------------
            //aw,  18.09.09: Init
            //***************************************************************
            string ltError = "";

            mobjMainApplication = pobjMainApplication;

            mAddInObject.EventRegister(ISiDiary.genmEvent.All);

            mtCurrentLanguage = mAddInObject.CurrentLanguage(mobjMainApplication);

            if (!mAddInObject.AddMenu("mnuCS2008E", mtGetLanguageText(2), 1, ref ltError))
            {
                System.Windows.Forms.MessageBox.Show(ltError);
            }


            if (mfrmAddIn == null)
            {
                mfrmAddIn = new frmAddIn();
                mfrmAddIn.InitObjects(this);
            }
        }