예제 #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());
            }
        }
예제 #2
0
 public void CTPFactoryAvailable(Office.ICTPFactory CTPFactoryInst)
 {
     if (CTPFactoryInst != null)
     {
         // Create a new task pane.
         taskPane = CTPFactoryInst.CreateCTP(
             "Microsoft.Samples.Vsto.CS.TaskPaneUI",
             "Contoso");
         taskPane.Visible = true;
     }
 }
예제 #3
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;
         }
     }
 }
예제 #4
0
        public void CTPFactoryAvailable(Office.ICTPFactory CTPFactoryInst)
        {
            try
            {
                String taskPaneTitle = ConfigurationManager.AppSettings["taskPaneTitle"];
                if (taskPaneTitle == null)
                {
                    taskPaneTitle = "default";
                }

                taskPane = CTPFactoryInst.CreateCTP(
                    "TestExcel2007Addin.SimpleControl", taskPaneTitle, Type.Missing);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #5
0
 private void AddOAMailPanel()
 {
     try
     {
         _mailPanel = new OAPanel();
         _mailPanel.Application = Application;
         _myCustomTaskPane = this.CustomTaskPanes.Add(_mailPanel, "Outlook-Addin");
         _mailPanel.Dock = DockStyle.Fill;
         _myCustomTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionFloating;
         _myCustomTaskPane.Width = 210;
         _myCustomTaskPane.Height = 175;
         _myCustomTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
         _myCustomTaskPane.Visible = true;
     }
     catch (Exception e)
     {
         _logger.Error("Error while creating OAPanel :" + e);
         throw e;
     }
 }
예제 #6
0
 public InspectorCloseHandler(Connect addin, Office.CustomTaskPane ctp)
 {
     this.addin = addin;
     this.ctp   = ctp;
 }