コード例 #1
0
ファイル: Ribbon2.cs プロジェクト: res0o43m/Redaction
        //Create callback methods here. For more information about adding callback methods, visit https://go.microsoft.com/fwlink/?LinkID=271226

        public void RibbonLoad(Office.IRibbonUI ribbonUI)
        {
            this.ribbon = ribbonUI;
            //register events
            Application          = Globals.ThisAddIn.Application;
            SelectionChangeEvent = new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowSelectionChangeEventHandler(Application_WindowSelectionChange);
            Application.WindowSelectionChange += SelectionChangeEvent;
            DocumentChangeEvent         = new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentChangeEventHandler(Application_DocumentChange);
            Application.DocumentChange += DocumentChangeEvent;
        }
コード例 #2
0
ファイル: MyRibbon.cs プロジェクト: res0o43m/Redaction
        public void Ribbon_Load(Office.IRibbonUI ribbonUI)
        {
            //hold a handle to the ribbon so we can refresh controls later
            this.Ribbon = ribbonUI;

            //register events
            Application          = Globals.ThisAddIn.Application;
            SelectionChangeEvent = new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowSelectionChangeEventHandler(Application_WindowSelectionChange);
            Application.WindowSelectionChange += SelectionChangeEvent;
            DocumentChangeEvent         = new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentChangeEventHandler(Application_DocumentChange);
            Application.DocumentChange += DocumentChangeEvent;
        }
        internal ApplicationEvents(RibbonToggleButton button, IDictionary <Word.Window, CustomTaskPane> dictTaskPanes)
        {
            //store the application and Ribbon objects
            m_buttonMapping = button;
            m_dictTaskPanes = dictTaskPanes;

            //store MDI/SDI state
            m_fLastSdiMode = Globals.ThisAddIn.Application.ShowWindowsInTaskbar;

            //capture the necessary app events
            m_ehDocumentChange = new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentChangeEventHandler(app_DocumentChange);
            m_ehWindowActivate = new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowActivateEventHandler(app_WindowActivate);
            Globals.ThisAddIn.Application.DocumentChange += m_ehDocumentChange;
            Globals.ThisAddIn.Application.WindowActivate += m_ehWindowActivate;
        }
コード例 #4
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            try
            {
                InitializeLogger();
            }
            catch
            { // we want to silently fail here. Logging won't work, but at least it won't bring down the app.
            }

            try
            {
                SupportEmailAddress = SitecoreClient.GetContactEmail();
            }
            catch (Exception ex)
            {
                SupportEmailAddress = "";
                this.LogException("Unable to retrieve email for support!", ex);
            }

            try
            {
                InitializePlugin();
                _startup            = new Word.ApplicationEvents4_DocumentChangeEventHandler(Application_DocumentChange);
                _beforeCloseHandler = new ApplicationEvents4_DocumentBeforeCloseEventHandler(Application_BeforeDocumentClose);

                Application.DocumentChange      += _startup;
                Application.DocumentOpen        += OpenArticleInformationWindowIfNeeded;
                Application.DocumentBeforeClose += _beforeCloseHandler;
                Application.DocumentChange      += Application_DocumentChange_UpdateRibbon;
            }
            catch (Exception ex)
            {
                Log("Exception occurred during startup: " + ex.Message);
                Log("stack trace: " + ex.StackTrace);
            }
        }
コード例 #5
0
        internal ApplicationEvents(Ribbon rm, IDictionary<Word.Window, CustomTaskPane> dictTaskPanes)
        {
            //store the application and Ribbon objects
            //m_buttonMapping = rm.toggleButtonMapping;
            m_ribbon = rm;
            m_dictTaskPanes = dictTaskPanes;

            //store MDI/SDI state
            m_fLastSdiMode = Globals.ThisAddIn.Application.ShowWindowsInTaskbar;
            log.Debug("ShowWindowsInTaskbar? " + m_fLastSdiMode);

            //capture the necessary app events
            m_ehDocumentChange = new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentChangeEventHandler(app_DocumentChange);
            m_ehWindowActivate = new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowActivateEventHandler(app_WindowActivate);
            Globals.ThisAddIn.Application.DocumentChange += m_ehDocumentChange;
            Globals.ThisAddIn.Application.WindowActivate += m_ehWindowActivate;
        }