Esempio n. 1
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // Initialize timers and display panels
            documentEditTimes = new Dictionary <string, DocumentTimer>();
            timerDisplayPanes = new List <Microsoft.Office.Tools.CustomTaskPane>();

            // Add event handlers
            Word.ApplicationEvents4_Event eventInterface = this.Application;
            eventInterface.DocumentOpen        += new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentOpenEventHandler(eventInterface_DocumentOpen);
            eventInterface.NewDocument         += new Microsoft.Office.Interop.Word.ApplicationEvents4_NewDocumentEventHandler(eventInterface_NewDocument);
            eventInterface.DocumentBeforeClose += new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentBeforeCloseEventHandler(eventInterface_DocumentBeforeClose);
            eventInterface.WindowActivate      += new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowActivateEventHandler(eventInterface_WindowActivate);

            // Start monitoring active document
            MonitorDocument(this.Application.ActiveDocument);
            AddTaskPaneToWindow(this.Application.ActiveDocument.ActiveWindow);
        }
Esempio n. 2
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            logger = LogHelper.InitialiseNLog();

            // Initialize timers and display panels
            documentEditProperties = new Dictionary <string, TemplateDetails>();
            SAPOLDisplayPanes      = new List <Microsoft.Office.Tools.CustomTaskPane>();

            // Add event handlers
            Word.ApplicationEvents4_Event eventInterface = this.Application;
            eventInterface.DocumentOpen        += new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentOpenEventHandler(eventInterface_DocumentOpen);
            eventInterface.NewDocument         += new Microsoft.Office.Interop.Word.ApplicationEvents4_NewDocumentEventHandler(eventInterface_NewDocument);
            eventInterface.DocumentBeforeClose += new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentBeforeCloseEventHandler(eventInterface_DocumentBeforeClose);
            //eventInterface.WindowActivate += new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowActivateEventHandler(eventInterface_WindowActivate);
            //eventInterface.DocumentBeforeSave += new ApplicationEvents4_DocumentBeforeSaveEventHandler(eventInterface_DocumentBeforeSave);

            // Start monitoring active document
            MonitorDocument(this.Application.ActiveDocument);
        }