private void newInspector(Outlook.Inspector inspector)
        {
            if (inspector.CurrentItem is Outlook.MailItem)
            {
                // Cast and create wrapper
                Outlook.MailItem mailItem   = inspector.CurrentItem;
                editorWrapper    newWrapper = new editorWrapper(mailItem);

                // Wrapper created, register Application level callbacks
                inspector.Application.ItemSend += (object item, ref bool cancel) =>
                {
                    inspector.CurrentItem.DeferredDeliveryTime = // Implement 30 second delay if enabled
                                                                 (newWrapper.toggleDelay) ? (DateTime.Now).Add(new TimeSpan(0, 0, 30)) : new DateTime(4501, 1, 1);
                };

                // Register Window level callbacks
                ((Outlook.InspectorEvents_10_Event)inspector).Activate += newWrapper.runTimer;
                inspector.Deactivate += newWrapper.pauseTimer;
                ((Outlook.InspectorEvents_10_Event)inspector).Close += () => { editorWrapperCollection.Remove(inspector.GetHashCode()); };

                // Register mail item callbacks
                mailItem.Open          += (ref bool s) => { newWrapper.addInVisible = newWrapper.getTaskPane.Visible = false; }; // Prevent ribbon options from blinking when changing drafts
                mailItem.AttachmentAdd += newWrapper.examineAttachment;
                mailItem.Unload        += newWrapper.deconstructWrapper;

                // That's a wrap
                editorWrapperCollection.Add(inspector.GetHashCode(), newWrapper);
            }
        }
        private void newExplorer(Outlook.Explorer explorer)
        {
            // Register inline response events
            explorer.InlineResponse += (s) =>
            {
                // Check to see what kind of inline it is. Not sure how many there are.
                if (!(s is Outlook.MailItem))
                {
                    Debug.Print("Vat da faaack"); return;
                }

                Outlook.MailItem mailItem   = s as Outlook.MailItem;
                editorWrapper    newWrapper = new editorWrapper(mailItem);

                // Wrapper created, register Application level callbacks
                explorer.Application.ItemSend += (object item, ref bool cancel) =>
                {
                    explorer.ActiveInlineResponse.DeferredDeliveryTime = // Implement 30 second delay if enabled
                                                                         (newWrapper.toggleDelay) ? (DateTime.Now).Add(new TimeSpan(0, 0, 30)) : new DateTime(4501, 1, 1);
                };

                // Register Window level callbacks
                ((Outlook.ExplorerEvents_10_Event)explorer).Activate += newWrapper.runTimer;
                explorer.Deactivate += newWrapper.pauseTimer;
                // ((Outlook.ExplorerEvents_10_Event)explorer).Close += () => { editorWrapperCollection.Remove(explorer.GetHashCode()); };

                // Register mail item callbacks
                mailItem.Open          += (ref bool b) => { newWrapper.addInVisible = newWrapper.getTaskPane.Visible = false; }; // Prevent ribbon options from blinking when changing drafts
                mailItem.AttachmentAdd += newWrapper.examineAttachment;
                // mailItem.Unload += newWrapper.deconstructWrapper;

                // That's a wrap
                editorWrapperCollection.Add(explorer.GetHashCode(), newWrapper);
                // Don't wait the whole second for first poll
                newWrapper.reviewEditor(null);
            };

            explorer.InlineResponseClose += () =>
            {
                editorWrapper thisWrapper = editorWrapperCollection[Application.ActiveExplorer().GetHashCode()];

                ((Outlook.ExplorerEvents_10_Event)explorer).Activate -= thisWrapper.runTimer;
                explorer.Deactivate -= thisWrapper.pauseTimer;

                thisWrapper.deconstructWrapper();
                editorWrapperCollection.Remove(Application.ActiveExplorer().GetHashCode());
            };
        }
 public secureSendPane(editorWrapper from)
 {
     myWrapper = from;
     InitializeComponent();
 }