Exemplo n.º 1
0
 public void UpdateCTP(List <string> names)
 {
     foreach (var i in DicCustomCTP.ToList())
     {
         CustomTaskPane ctp = DicCustomCTP[i.Key];
         CTPControl     uc  = null;
         try
         {
             uc = (CTPControl)ctp.ContentControl;
             uc.UpdateListView(names);
             uc.UpdateMessage(DicCustomCTP.Keys);
         }catch (Exception)
         {
             DicCustomCTP.Remove(i.Key);
         }
     }
 }
Exemplo n.º 2
0
 public void ShowCTP(string hwnd)
 {
     //Office 2013 is SDI(single document interface) https://www.add-in-express.com/creating-addins-blog/2013/02/28/excel2013-single-document-interface-task-panes/
     if (DicCustomCTP.ContainsKey(hwnd))
     {
         CustomTaskPane ctp = DicCustomCTP[hwnd];
         if (ctp != null)
         {
             ctp.Visible = true;
         }
     }
     else
     {
         uc  = new CTPControl();
         ctp = CustomTaskPaneFactory.CreateCustomTaskPane(userControl: uc, "Workbooks");
         ctp.DockPosition             = MsoCTPDockPosition.msoCTPDockPositionRight;
         ctp.DockPositionStateChange += ctp_DockPositionStateChange;
         ctp.VisibleStateChange      += ctp_VisibleStateChange;
         ctp.Visible = true;
         DicCustomCTP.Add(hwnd, ctp);
     }
 }