Exemple #1
0
        void inspectors_NewInspector(Outlook.Inspector Inspector)
        {
            try
            {
                // When a new Inspector opens, create a task pane and attach
                // it to this Inspector. Also add the task pane<-->Inspector
                // mapping to the collection.
                Office.CustomTaskPane taskPane = taskPaneFactory.CreateCTP(
                    "TestOutlook2007Addin.SimpleControl", taskPaneTitle,
                    Inspector);
                inspectorPanes.Add(taskPane, Inspector);

                // Sink the Close event on this Inspector to make sure the
                // task pane is also destroyed.
                itemEvents =
                    (Outlook.ItemEvents_10_Event)Inspector.CurrentItem;
                InspectorCloseHandler chc =
                    new InspectorCloseHandler(this, taskPane);
                itemEvents.Close +=
                    new Outlook.ItemEvents_10_CloseEventHandler(
                        chc.CloseEventHandler);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #2
0
        /**
         * @param Inspector rappresenta un oggetto
         * di tipo Outlook.Inspector restituito dalla registrazione dell'evento
         * InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector)
         * Il metodo crea un oggetto di tipo Outlook.MailItem e registra l'evento
         * Inspector.CurrentItem as Outlook.ItemEvents_10_Event
         */
        void Inspectors_NewInspector(Outlook.Inspector Inspector)
        {
            string pos = "ThisAddIn.Inspectors_NewInspector - ";

            log.Info(pos + "INIT");

            currMailItem = Guid.NewGuid().ToString();

            if (MailItems.ContainsKey(Globals.ThisAddIn.currMailItem))
            MailItems.Remove(Globals.ThisAddIn.currMailItem);
            MailItems.Add(currMailItem, Inspector.CurrentItem);

            if (Inspector.CurrentItem is Outlook.MailItem)
            {
            mailEvents = Inspector.CurrentItem as Outlook.ItemEvents_10_Event;
            mailEvents.Reply += new Outlook.ItemEvents_10_ReplyEventHandler(mail_Reply);
            mailEvents.ReplyAll += new Outlook.ItemEvents_10_ReplyAllEventHandler(mail_Reply);
            mailEvents.Forward += new Outlook.ItemEvents_10_ForwardEventHandler(mail_Reply);
            mailEvents.Read += new ItemEvents_10_ReadEventHandler(mailEvents_Read);
            mailEvents.Open += new ItemEvents_10_OpenEventHandler(mailEvents_Open);
            }

            log.Info(pos + "END");
        }