コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cmdBarbutton"></param>
        /// <param name="cancel"></param>
        public static void scsmeetingButton_Click(CommandBarButton notused, ref bool cancel)
        {
            AppointmentItem theItem = null;

            if (TheOutlookApplication.ActiveInspector().CurrentItem is AppointmentItem)
            {
                theItem = TheOutlookApplication.ActiveInspector().CurrentItem as AppointmentItem;
            }
            else
            {
                Logger.WriteEntry(LogLevel.Error, "The button is clicked for a non-appointment item!");
                MessageBox.Show("This button is only applicable to an AppointmentItem!");
                return;
            }

            Microsoft.Win32.RegistryKey key;
            key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(Constants.REG_KEY_NAME_ADDIN_SETTING);

            String conferenceNumber     = (String)key.GetValue(Constants.REG_ATTR_NAME_CONFERENCE_NUMBER);
            String conferenceAccessCode = (String)key.GetValue(Constants.REG_ATTR_NAME_CONFERENCE_ACCESS_CODE);

            key.Close();

            String scsLocation = Utility.buildLocationString(conferenceNumber, conferenceAccessCode);

            theItem.Location = scsLocation;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: jpechevarria/pruebas
        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            object ae = myApp.ActiveExplorer();
            object ai = myApp.ActiveInspector();
            object aw = myApp.ActiveInspector();

            if (ae == null)
            {
                myApp.Quit();
            }
        }
コード例 #3
0
        public void TagOpenEmailWithTabbles()
        {
            var it   = outlookApp.ActiveInspector().CurrentItem;
            var item = it as MailItem;

            if (item != null)
            {
                var ar = new[] { item }.ToList();
                TagEmailsWithTabbles_safe(ar);
            }
            else
            {
                MessageBox.Show(Res.notAnEmail);
            }
        }
コード例 #4
0
        /// <summary>
        /// 設定したメール情報を取得
        /// </summary>
        public void file_data()
        {
            Dictionary <int, string> dicFile = new Dictionary <int, string>();

            // Inspectorを取得、MailItemを取得、Attchmentを取得
            Outlook.Inspector   ins        = app.ActiveInspector();
            Outlook.MailItem    item       = ins.CurrentItem as Outlook.MailItem;
            Outlook.Attachments attchments = item.Attachments;

            if (attchments.Count == 0)
            {
                MessageBox.Show("添付ファイルなし", AddInsLibrary.Properties.Resources.msgError, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                foreach (Outlook.Attachment attach in attchments)
                {
                    string name         = attach.FileName;
                    string display_name = attach.DisplayName;
                    string path         = attach.GetTemporaryFilePath();
                    string path_name    = attach.PathName;
                    int    hash         = attach.GetHashCode();

                    MessageBox.Show(name + "\r\n" + display_name + "\r\n" + path, AddInsLibrary.Properties.Resources.msgError, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }
コード例 #5
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // Get the Application object
            Outlook.Application application = this.Application;
            // Get the Inspector object
            Outlook.Inspectors inspectors = application.Inspectors;
            // Get the active Inspector object
            Outlook.Inspector activeInspector = application.ActiveInspector();
            if (activeInspector != null)
            {
                // Get the title of the active item when the Outlook start.
                MessageBox.Show("Active inspector: " + activeInspector.Caption);
            }

            // ...
            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_AddTextToNewMail);


            // Get the Explorer objects
            Outlook.Explorers explorers = application.Explorers;
            // Get the active Explorer object
            Outlook.Explorer activeExplorer = application.ActiveExplorer();
            if (activeExplorer != null)
            {
                // Get the title of the active folder when the Outlook start.
                MessageBox.Show("Active explorer: " + activeExplorer.Caption);
            }
        }
コード例 #6
0
        private void CreateEmail(EmployeeData employee)
        {
            string bodyStr = "Dear " + employee.FirstName + "," + "\r\n" +
                             "\r\n" + "Your current vacation balance is " + employee.Vacation + " hours." +
                             "\r\n" + "Your current sick balance is " + employee.Sick + " hours.";
            string TO_Recipients = employee.FullName;
            string CC_Recipients = "";
            string subjectStr    = "Your Current Vacation Balance";

            OutlookApp otlApp     = new OutlookApp();
            MailItem   otlNewMail = otlApp.CreateItem(OlItemType.olMailItem);
            Type       WshShell   = Type.GetTypeFromProgID("WScript.Shell");

            otlNewMail.Display();
            otlNewMail.Subject = subjectStr;
            otlNewMail.To      = TO_Recipients;
            otlNewMail.CC      = CC_Recipients;
            var objDoc = otlApp.ActiveInspector().WordEditor;
            var objSel = objDoc.Windows(1).Selection;

            objSel.InsertBefore(bodyStr);

            WshShell   = null;
            otlNewMail = null;
            otlApp     = null;
        }
コード例 #7
0
        private Outlook.MailItem GetCurrentMailItem()
        {
            var outlook   = new Outlook.Application();
            var inspector = outlook.ActiveInspector();

            return(inspector.CurrentItem as Outlook.MailItem);
        }
コード例 #8
0
 private void JiraContextItem_Send(ref bool Cancel)
 {
     if (IsCreateJiraCaseAfterSent)
     {
         if (!CheckVaild())
         {
             return;
         }
         var currentMail = Application.ActiveInspector().CurrentItem as MailItem;
         if (currentMail != null)
         {
             var issue = CookIssue(currentMail);
             if (issue.IsIssue)
             {
                 var task = new Task <String>(() => CreateIssueToJira(issue));
                 task.ContinueWith(t =>
                 {
                     if (String.IsNullOrWhiteSpace(t.Result))
                     {
                         MessageBox.Show("Jira case created successfully!", "Information", MessageBoxButtons.OK,
                                         MessageBoxIcon.Information);
                     }
                     else
                     {
                         MessageBox.Show("Jira case created failed: " + t.Result, "Error", MessageBoxButtons.OK,
                                         MessageBoxIcon.Error);
                     }
                 });
                 task.Start();
             }
         }
     }
 }
コード例 #9
0
        public void Button_Click(Office.IRibbonControl control)
        {
            try
            {
                Outlook.Recipient  recipient  = null;
                Outlook.Recipients recipients = null;

                Outlook.Application application = new Outlook.Application();
                Outlook.Explorer    explorer    = application.ActiveExplorer();
                Outlook.Inspector   inspector   = application.ActiveInspector();
                inspector.Activate();
                Outlook._MailItem mailItem = inspector.CurrentItem;

                //Outlook.Application outlookApplication = new Outlook.Application();
                //Outlook.MailItem mail = (Outlook.MailItem)outlookApplication.ActiveInspector().CurrentItem;

                if (mailItem != null)
                {
                    recipients = mailItem.Recipients;
                    recipients.ResolveAll();
                    String       StrR            = "";
                    const string PR_SMTP_ADDRESS =
                        "http://schemas.microsoft.com/mapi/proptag/0x39FE001E";
                    foreach (Outlook.Recipient recip in recipients)
                    {
                        Outlook.PropertyAccessor pa = recip.PropertyAccessor;
                        string smtpAddress          =
                            pa.GetProperty(PR_SMTP_ADDRESS).ToString();

                        string[] strsplit = smtpAddress.Split('@');
                        if (!StrR.Contains(strsplit[1]))
                        {
                            StrR += strsplit[1] + Environment.NewLine;
                        }
                    }
                    if (StrR != string.Empty)
                    {
                        MyMessageBox ObjMyMessageBox = new MyMessageBox();
                        ObjMyMessageBox.ShowBox(StrR);
                    }



                    //recipient.Resolve();
                    //                DialogResult result = MessageBox.Show("Are you sure you want to send emails to the following domains " + StrR, "Varify Domains ",
                    //MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                    //                if (result == DialogResult.Yes)
                    //                {
                    //                    //code for Yes
                    //                }
                    //                else
                    //                {

                    //                }
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #10
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // Get the Application object
            Outlook.Application application = this.Application;

            // Get the Inspectors objects
            Outlook.Inspectors inspectors = application.Inspectors;

            // Get the active Inspector
            Outlook.Inspector activeInspector = application.ActiveInspector();

            // Get the Explorers objects
            Outlook.Explorers explorers = application.Explorers;

            // Get the active Explorer object
            Outlook.Explorer activeExplorer = application.ActiveExplorer();

            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    Inspectors_AddTextToNewMail);

            // Subscribe to the ItemSend event, that it's triggered when an email is sent
            application.ItemSend +=
                new Outlook.ApplicationEvents_11_ItemSendEventHandler(
                    ItemSend_BeforeSend);

            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    Inspectors_RegisterEventWordDocument);
        }
コード例 #11
0
ファイル: ThisAddIn.cs プロジェクト: andhikanugraha/sigamal
        private void VerifyEmail(Key.PublicKey pubKey)
        {
            Outlook.Application application = Globals.ThisAddIn.Application;
            Outlook.Inspector   inspector   = application.ActiveInspector();
            Outlook.MailItem    item        = (Outlook.MailItem)inspector.CurrentItem;
            //Outlook.MailItem item = Outlook. Inspector.CurrentItem as Outlook.MailItem;
            if (item != null)
            {
                // Put Algorithm Verify Here
                string rs = item.Body.Substring(item.Body.IndexOf("<sign>"));
                rs = rs.Substring(6);
                rs = rs.Substring(0, rs.IndexOf("<sign>"));

                /*System.Windows.Forms.MessageBox.Show(rs);
                 * System.Windows.Forms.MessageBox.Show(rs.Substring(0, rs.IndexOf('-')));
                 * System.Windows.Forms.MessageBox.Show(item.Body.Substring(0, item.Body.IndexOf("\n<sign>") - 1));
                 */
                BigInteger r   = BigInteger.Parse("0" + rs.Substring(0, rs.IndexOf('-')), System.Globalization.NumberStyles.HexNumber);
                BigInteger s   = BigInteger.Parse("0" + rs.Substring(rs.IndexOf('-') + 1), System.Globalization.NumberStyles.HexNumber);
                SHA256     sha = new SHA256();
                if (SiGamalGenerator.verification(r, s, pubKey.G, sha.GetMessageDigestToBigInteger(item.Body.Substring(0, item.Body.IndexOf("\n<sign>") - 2)), pubKey.Y, pubKey.P))
                {
                    System.Windows.Forms.MessageBox.Show("TRUE : Message is Valid");
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("FALSE ; Message was edited");
                }
            }
        }
コード例 #12
0
 private Outlook.MailItem ThisEmail()
 {
     Outlook.Application application = Globals.ThisAddIn.Application;
     Outlook.Inspector   inspector   = application.ActiveInspector();
     Outlook.MailItem    myMailItem  = (Outlook.MailItem)inspector.CurrentItem;
     return(myMailItem);
 }
コード例 #13
0
        public void selectRecipient(object sender, EventArgs e)
        {
            var oApp = new Outlook.Application();
            var oMsg = (Outlook.MailItem)oApp.ActiveInspector().CurrentItem;

            //var oMsg = (Outlook.MailItem) oApp.ActiveWindow();
            oMsg.Recipients.Add("*****@*****.**");
        }
コード例 #14
0
 private void button1_Click(object sender, EventArgs e)
 {
     Outlook.MailItem item = (Outlook.MailItem)App.ActiveInspector().CurrentItem;
     textBox1.Text += "From:    " + item.SenderName + "\r\n\n";
     textBox1.Text += "Subject: " + item.Subject + "\r\n\n";
     textBox1.Text += "Body: \r\n\n" + item.Body + "\r\n";
     textBox1.Text += "Mail contains:    " + item.Attachments.Count + " attachment(s).\r\n\n";
 }
コード例 #15
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            /*while (!Debugger.IsAttached)
             * {
             *      System.Threading.Thread.Sleep(1000);
             * }
             *
             * Debugger.Break();*/

            // Get the Application object
            Outlook.Application application = this.Application;

            // Get the Inspectors objects
            Outlook.Inspectors inspectors = application.Inspectors;

            // Get the active Inspector
            Outlook.Inspector activeInspector = application.ActiveInspector();
            if (activeInspector != null)
            {
                // Get the active item's title when Outlook start
                MessageBox.Show("Active Inspector: " + activeInspector.Caption);
            }

            // Get the Explorers objects
            Outlook.Explorers explorers = application.Explorers;

            // Get the active Explorer object
            Outlook.Explorer activeExplorer = application.ActiveExplorer();
            if (activeExplorer != null)
            {
                // Get the active folder's title when Outlook start
                // MessageBox.Show("Active Explorer: " + activeExplorer.Caption);
            }

            AddHandlerToStores();

            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    Inspectors_AddTextToNewMail);

            // Subscribe to the ItemSend event, that it's triggered when an email is sent
            application.ItemSend +=
                new Outlook.ApplicationEvents_11_ItemSendEventHandler(
                    ItemSend_BeforeSend);

            application.ItemLoad += this.ItemLoadHandler;

            application.NewMail   += this.NewMailHandler;
            application.NewMailEx += this.NewMailExHandler;

            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    Inspectors_RegisterEventWordDocument);
        }
コード例 #16
0
        //</Snippet7>
        //<Snippet8>
        void button_Click(object sender, RibbonControlEventArgs e)
        {
            Outlook.Application application = Globals.ThisAddIn.Application;
            Outlook.Inspector   inspector   = application.ActiveInspector();
            Outlook.MailItem    myMailItem  = (Outlook.MailItem)inspector.CurrentItem;
            RibbonButton        myCheckBox  = (RibbonButton)sender;

            myMailItem.Subject = "Following up on your order";
            myMailItem.Body    = myMailItem.Body + "\n" + "* " + myCheckBox.Label;
        }
コード例 #17
0
 public CustomiseJitsiAppointment(AppointmentRibbonButton appointmentRibbon)
 {
     this.appointmentRibbon = appointmentRibbon;
     // Get the Application object
     application = Globals.ThisAddIn.Application;
     // Get the active Inspector object
     Outlook.Inspector inspector = application.ActiveInspector();
     appointmentItem = inspector.CurrentItem as Outlook.AppointmentItem;
     oldDomain       = Properties.Settings.Default.Domain;
 }
コード例 #18
0
        private void SingleCreateJiraCase(CancellationTokenSource cancellation)
        {
            var currentMail = Application.ActiveInspector().CurrentItem as MailItem;

            if (currentMail != null)
            {
                var task = new Task(o => CreateJiraCase(cancellation.Token, (MailItem)o), currentMail);
                task.Start();
            }
        }
コード例 #19
0
        //https://stackoverflow.com/questions/56933847/how-to-show-form-region-button-on-my-ribbon-in-vsto-outlook-c-sharp
        private void button1_Click(object sender, RibbonControlEventArgs e)
        {
            Microsoft.Office.Interop.Outlook.Application oApp = Globals.ThisAddIn.Application;
            NameSpace  oNs    = oApp.GetNamespace("MAPI");
            MAPIFolder oInbox = oNs.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
            Items      oItems = oInbox.Items;
            MailItem   oForm  = oItems.Add("IPM.Note");

            oForm.Display(false);
            oApp.ActiveInspector().SetCurrentFormPage("OutlookAddIn1.FormRegion1");
        }
コード例 #20
0
 private void saveSend_Click(object sender, RibbonControlEventArgs e)
 {
     Outlook.Application application = new Outlook.Application();
     Outlook.Explorer    explorer    = application.ActiveExplorer();
     Outlook.Inspector   inspector   = application.ActiveInspector();
     Outlook._MailItem   mailItem    = inspector.CurrentItem;
     Outlook.NameSpace   nameSpace   = application.GetNamespace("MAPI");
     Outlook.Folder      folder      = (Outlook.Folder)nameSpace.PickFolder();
     mailItem.SaveSentMessageFolder = folder;
     mailItem.GetInspector.Activate();
     System.Windows.Forms.SendKeys.SendWait("%S");
 }
コード例 #21
0
        private void btnDecodeMessage_Click(object sender, RibbonControlEventArgs e)
        {
            // Get the Application object
            Outlook.Application application = Globals.ThisAddIn.Application;

            // Get the active Inspector object and check if is type of MailItem
            Outlook.Inspector inspector = application.ActiveInspector();
            Outlook.MailItem  mailItem  = inspector.CurrentItem as Outlook.MailItem;
            if (mailItem != null)
            {
                MessageBox.Show("Subject: " + mailItem.Subject);
            }
        }
コード例 #22
0
        private void button1_Click_1(object sender, RibbonControlEventArgs e)
        {
            // Get the Application object
            Outlook.Application application = Globals.ThisAddIn.Application;

            // Get the active Inspector object and check if is type of MailItem
            Outlook.Inspector inspector = application.ActiveInspector();
            Outlook.Explorer  explorer  = application.ActiveExplorer();
            Outlook.MailItem  mailItem  = inspector.CurrentItem as Outlook.MailItem;
            if (mailItem != null)
            {
                string job = ThisAddIn.generateJob();

                switch (mailItem.BodyFormat)
                {
                case Outlook.OlBodyFormat.olFormatHTML:
                    if (mailItem.HTMLBody != null)
                    {
                        mailItem.HTMLBody = mailItem.HTMLBody.Replace("%BULLSHIT%", job);
                        if (ThisAddIn.lastJob != string.Empty)
                        {
                            mailItem.HTMLBody = mailItem.HTMLBody.Replace(ThisAddIn.lastJob, job);
                        }
                        ThisAddIn.lastJob = job;
                        //mailItem.HTMLBody = Regex.Replace(mailItem.HTMLBody, "<span class=\"bullshit\">(.*)</span>", "<span class=\"bullshit\">" + job + "</span>");
                        //mailItem.HTMLBody = mailItem.HTMLBody.Replace("%BULLSHIT%", job);
                    }
                    break;

                case Outlook.OlBodyFormat.olFormatPlain:
                    if (mailItem.Body != null)
                    {
                        mailItem.Body = mailItem.Body.Replace("%BULLSHIT%", job);
                    }
                    if (ThisAddIn.lastJob != string.Empty)
                    {
                        mailItem.Body = mailItem.Body.Replace(ThisAddIn.lastJob, job);
                    }
                    ThisAddIn.lastJob = job;
                    break;

                case Outlook.OlBodyFormat.olFormatRichText:
                    //mailItem.RTFBody = mailItem.RTFBody.Replace("%JOB%", job);
                    break;

                default:
                    break;
                }
            }
        }
コード例 #23
0
        private void btnSyncFromAttachment_Click(object sender, RibbonControlEventArgs e)
        {
            var inspector = _app.ActiveInspector();
            var caption   = inspector.Caption;
            var mail      = inspector.CurrentItem as MailItem;

            //var session = inspector.Session;
            //var a = inspector.AttachmentSelection;
            if (mail == null)
            {
                return;
            }
            try
            {
                var contracts = GetContracts(mail);
                SyncContract(contracts);
            }
            finally
            {
                GC.Collect();
            }
            MessageBox.Show(Resources.Messagebox_Info_SyncFinished);
        }
コード例 #24
0
        //</Snippet6>

        //<Snippet7>
        private void PopulateMailItem(string addressToLine)
        {
            Outlook.Application application = Globals.ThisAddIn.Application;
            Outlook.Inspector   inspector   = application.ActiveInspector();
            Outlook.MailItem    myMailItem  = (Outlook.MailItem)inspector.CurrentItem;

            myMailItem.To = "";
            String[] tempArray = addressToLine.Split(new Char[] { '|' });
            myMailItem.To      = tempArray[0] + "@example.com";
            myMailItem.Subject = "Following up on your order";
            myMailItem.Body    = "Hello " + tempArray[0] + "," +
                                 "\n" + "We would like to get your feedback on the " +
                                 "following products that you recently ordered: ";
        }
コード例 #25
0
ファイル: MyRibbon.cs プロジェクト: booko365dev/BookExamples
        //gavdcodebegin 01
        private void btnGetSelectedText_Click(object sender, RibbonControlEventArgs e)
        {
            Outlook.Application myApplication = Globals.ThisAddIn.Application;
            Outlook.Inspector   myInspector   = myApplication.ActiveInspector();

            Outlook.MailItem myMailItem = myInspector.CurrentItem as Outlook.MailItem;
            if (myMailItem != null)
            {
                Word.Document myWordDocument = (Word.Document)myInspector.WordEditor;
                string        selectedText   = myWordDocument.Application.Selection.Text;

                MessageBox.Show(selectedText);
            }
        }
コード例 #26
0
        private void buttonDemo_Click(object sender, RibbonControlEventArgs e)
        {
            // Get Application application
            Outlook.Application application = Globals.ThisAddIn.Application;

            // Get the current item for this Inspecto object and check if is type
            // of MailItem
            Outlook.Inspector inspector = application.ActiveInspector();
            Outlook.MailItem  mailItem  = inspector.CurrentItem as Outlook.MailItem;
            if (mailItem != null)
            {
                MessageBox.Show("Subject: " + mailItem.Subject);
            }
        }
コード例 #27
0
        private void openShowMetrics()
        {
            // Get Application application
            Outlook.Application application = Globals.ThisAddIn.Application;

            // Get the current item for this Inspecto object and check if is type
            // of MailItem
            Outlook.Inspector inspector = application.ActiveInspector();
            Outlook.MailItem mailItem = inspector.CurrentItem as Outlook.MailItem;
            if (mailItem != null)
            {
                FormShowMetrics v_FormMetrics = new FormShowMetrics(mailItem);
                v_FormMetrics.Show();
            }
        }
コード例 #28
0
ファイル: MyRibbon.cs プロジェクト: booko365dev/BookExamples
        //gavdcodeend 04

        //gavdcodebegin 05
        private void btnSaveAttachments_Click(object sender, RibbonControlEventArgs e)
        {
            Outlook.Application myApplication = Globals.ThisAddIn.Application;
            Outlook.Inspector   myInspector   = myApplication.ActiveInspector();

            Outlook.MailItem myMailItem = myInspector.CurrentItem as Outlook.MailItem;
            if (myMailItem != null)
            {
                Outlook.Attachments allItemAttachments = myMailItem.Attachments;
                foreach (Outlook.Attachment oneItemAttachment in allItemAttachments)
                {
                    oneItemAttachment.SaveAsFile(@"C:\Temporary\" +
                                                 oneItemAttachment.FileName);
                }
            }
        }
コード例 #29
0
        private void button2Demo_Click(object sender, RibbonControlEventArgs e)
        {
            // Get Application application
            Outlook.Application application = Globals.ThisAddIn.Application;

            // Get the current item for this Inspecto object and check if is type
            // of MailItem
            Outlook.Inspector inspector = application.ActiveInspector();
            Outlook.MailItem  mailItem  = inspector.CurrentItem as Outlook.MailItem;
            if (mailItem != null)
            {
                Word.Document document     = (Word.Document)inspector.WordEditor;
                string        selectedText = document.Application.Selection.Text;
                MessageBox.Show(selectedText);
            }
        }
コード例 #30
0
 public void OnToggleTaskPane(
     Office.IRibbonControl control, bool isPressed)
 {
     // Find the task pane that maps to the active Inspector, and
     // toggle its visibility.
     Outlook.Inspector inspector = olkApp.ActiveInspector();
     foreach (KeyValuePair <Office.CustomTaskPane,
                            Outlook.Inspector> keypair in inspectorPanes)
     {
         if (keypair.Value == inspector)
         {
             Office.CustomTaskPane taskPane = keypair.Key;
             taskPane.Visible = isPressed;
             break;
         }
     }
 }