示例#1
0
 public static void ShowCTPSetting()
 {
     if (ctpConfig == null)
     {
         try
         {
             // Make a new one using ExcelDna.Integration.CustomUI.CustomTaskPaneFactory
             ctpConfig                          = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(frmConfig), "Cấu hình - AccNet UX");
             ctpConfig.Width                    = 320;
             ctpConfig.Visible                  = true;
             ctpConfig.DockPosition             = MsoCTPDockPosition.msoCTPDockPositionRight;
             ctpConfig.DockPositionStateChange += ctp_DockPositionStateChange;
             ctpConfig.VisibleStateChange      += ctp_VisibleStateChange;
         }
         catch (Exception ex)
         {
             throw;
         }
     }
     else
     {
         // Just show it again
         ctpConfig.Visible = true;
     }
 }
示例#2
0
 public static void CreateCTP()
 {
     uc  = new UserControl();
     ctp = CustomTaskPaneFactory.CreateCustomTaskPane(userControl: uc, title: "CTP");
     ctp.DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
     ctp.Visible      = true;
 }
示例#3
0
        public void Show(IRibbonControl control)
        {
            UserControlCTP uc  = new UserControlCTP();
            CustomTaskPane ctp = CustomTaskPaneFactory.CreateCustomTaskPane(uc, "Hello");

            ctp.DockPosition = MsoCTPDockPosition.msoCTPDockPositionBottom;
            ctp.Visible      = true;
        }
示例#4
0
        static CtpManager()
        {
            userPaneControl = new DemoPane();
            hostControl     = new DemoPaneHostControl();

            excelPane              = CustomTaskPaneFactory.CreateCustomTaskPane(hostControl, "User Login");
            excelPane.Visible      = false;
            excelPane.Width        = 300;
            excelPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionLeft;
        }
示例#5
0
        internal static CustomTaskPane Show(System.Type userControl, string title, MsoCTPDockPosition msoCTPDockPosition = MsoCTPDockPosition.msoCTPDockPositionLeft)
        {
            //throw new NotImplementedException();
            // create new custom task pane with ExcelDna.Integration.CustomUI.CustomTaskPaneFactory
            CustomTaskPane customTaskPane = CustomTaskPaneFactory.CreateCustomTaskPane(userControl, "newItem");

            customTaskPane.DockPosition        = msoCTPDockPosition;
            customTaskPane.Visible             = true;
            customTaskPane.VisibleStateChange += CustomTaskPane_VisibleStateChange;
            string uniqueControlName = customTaskPane.GetHashCode().ToString();

            CustomTaskPanes.Add(uniqueControlName, customTaskPane);
            return(customTaskPane);
        }
示例#6
0
文件: App.cs 项目: WaToI/xlTraceDNA
 public static void ShowCTP()
 {
     if (ctp == null)
     {
         ctp = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(CTPView), "xlTrace");
         //setPositionCtp();
         ctp.DockPositionStateChange += CTP_DockPositionStateChange;
         ctp.Visible = true;
     }
     else
     {
         ctp.Visible = true;
     }
 }
示例#7
0
 public static void ShowCTP()
 {
     if (ctp == null)
     {
         // Make a new one using ExcelDna.Integration.CustomUI.CustomTaskPaneFactory
         ctp              = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(HelpSideBarControl), SwaggerRegistry.Api.Info.Title);
         ctp.Visible      = true;
         ctp.DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
     }
     else
     {
         // Just show it again
         ctp.Visible = true;
     }
 }
        public CustomTaskPane CreateCustomTaskPane <View, ViewModel>(string Header) where View : FrameworkElement
        {
            var ctPane    = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(HostToolsPane), Header);
            var view      = _serviceLocator.GetInstance <View>();
            var viewModel = _serviceLocator.GetInstance <ViewModel>();

            view.DataContext = viewModel;
            (ctPane.ContentControl as HostToolsPane).Host.Child = view;
            //ctPane.Visible = true;
            //ctPane.VisibleStateChange += CtPane_VisibleStateChange;
            ctPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
            ctPane.Width        = 600;
            //ctPane.Height = 800;
            return(ctPane);
        }
示例#9
0
 public static void ShowCTP()
 {
     //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 (ctp == null)
     {
         ctp = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(CTPControls), "Custom CTP");
         ctp.DockPosition             = MsoCTPDockPosition.msoCTPDockPositionRight;
         ctp.DockPositionStateChange += ctp_DockPositionStateChange;
         ctp.VisibleStateChange      += ctp_VisibleStateChange;
         ctp.Visible = true;
     }
     else
     {
         ctp.Visible = true;
     }
 }
示例#10
0
        public void ShowSecKeyTaskPane(IRibbonControl control)
        {
            if (_secKeyTaskPane == null)
            {
                var secKeyLoader = new LoadSecKey();
                secKeyLoader.InitSecretarium(this);

                _secKeyTaskPane              = CustomTaskPaneFactory.CreateCustomTaskPane(secKeyLoader, "Secretarium");
                _secKeyTaskPane.Visible      = true;
                _secKeyTaskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
                _secKeyTaskPane.Width        = 500;
            }
            else
            {
                _secKeyTaskPane.Visible = true;
            }
        }
示例#11
0
        public void ShowX509TaskPane(IRibbonControl control)
        {
            if (_x509TaskPane == null)
            {
                var x509Loader = new LoadX509();
                x509Loader.InitSecretarium(this);

                _x509TaskPane              = CustomTaskPaneFactory.CreateCustomTaskPane(x509Loader, "Secretarium");
                _x509TaskPane.Visible      = true;
                _x509TaskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
                _x509TaskPane.Width        = 500;
            }
            else
            {
                _x509TaskPane.Visible = true;
            }
        }
 public static void ShowCTP()
 {
     if (ctp == null)
     {
         // Make a new one using ExcelDna.Integration.CustomUI.CustomTaskPaneFactory
         ctp                          = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(CTP_rangeexport), "My Super Task Pane");
         ctp.Visible                  = true;
         ctp.DockPosition             = MsoCTPDockPosition.msoCTPDockPositionLeft;
         ctp.DockPositionStateChange += ctp_DockPositionStateChange;
         ctp.VisibleStateChange      += ctp_VisibleStateChange;
     }
     else
     {
         // Just show it again
         ctp.Visible = true;
     }
 }
示例#13
0
 public static void ShowCTP()
 {
     if (ctp == null)
     {
         // Make a new one using ExcelDna.Integration.CustomUI.CustomTaskPaneFactory
         ctp = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(UserControlHost), "Corporate Header");
         ctp.DockPosition             = MsoCTPDockPosition.msoCTPDockPositionLeft;
         ctp.DockPositionStateChange += CTP_DockPositionStateChange;
         ctp.VisibleStateChange      += CTP_VisibleStateChange;
         ctp.Visible = true;
     }
     else
     {
         // Just show it again
         ctp.Visible = true;
     }
 }
示例#14
0
        public void ShowBase64KeysTaskPane(IRibbonControl control)
        {
            if (_keysTaskPane == null)
            {
                var keysLoader = new LoadKeys();
                keysLoader.InitSecretarium(this);

                _keysTaskPane              = CustomTaskPaneFactory.CreateCustomTaskPane(keysLoader, "Secretarium");
                _keysTaskPane.Visible      = true;
                _keysTaskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
                _keysTaskPane.Width        = 500;
            }
            else
            {
                _keysTaskPane.Visible = true;
            }
        }
示例#15
0
        public static void Show()
        {
            _excel = new Application(null, ExcelDna.Integration.ExcelDnaUtil.Application);
            if (ctpList.ContainsKey(Parent) == false)
            {
                CustomTaskPane ctp = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(CodeEditor), "Python Code Editor");
                CodeEditorPane cep = new CodeEditorPane(ctp, (CodeEditor)ctp.ContentControl);
                _excel.WorkbookActivateEvent += _excel_WorkbookActivateEvent;

                ctpList.Add(Parent, cep);
            }
            else
            {
                if (ctpList[Parent].Opened)
                {
                    Save();
                }
            }
            ctpList[Parent].Open();
        }
示例#16
0
        public static void SheetManagerCTP()
        {
            string paneID = null;

            if (AddinContext.XlApp != null)
            {
                paneID = "SheetManagerCTP" + AddinContext.XlApp.Hwnd.ToString();
                if (!CTP_DICT.ContainsKey(paneID))
                {
                    // Define Task Pane size on Action Pane Size.
                    var control = new SheetManagerCTP();
                    control_width  = control.Width;
                    control_height = control.Height;

                    // Init Task Pane
                    ctp = CustomTaskPaneFactory.CreateCustomTaskPane(control, "Sheet Manager");

                    // Then dock state change event can not change size so we need to config size on floating mode first.
                    ctp.DockPosition = MsoCTPDockPosition.msoCTPDockPositionFloating;
                    ctp.Height       = control_height;
                    ctp.Width        = control_width;
                    // Change back to default Dock Position
                    ctp.DockPosition             = MsoCTPDockPosition.msoCTPDockPositionLeft;
                    ctp.Width                    = control_width;
                    ctp.DockPositionStateChange += Ctp_DockPositionStateChange;
                    ctp.VisibleStateChange      += Ctp_VisibleStateChange;

                    // Update Table List on first run

                    // Add Task Pane on each workbook opened.
                    CTP_DICT.Add(paneID, ctp);
                }
                else
                {
                    // If Custom Task Pane already created, Call it from Dict and refresh Table List to be exported.
                    ctp = CTP_DICT.Single(x => x.Key == paneID).Value;
                }
            }
        }
示例#17
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);
     }
 }
示例#18
0
        public static void InitCTManager()
        {
            string paneID = null;

            if (AddinContext.XlApp != null)
            {
                paneID = "CTP" + AddinContext.XlApp.Hwnd.ToString();
                if (!CTP_DICT.ContainsKey(paneID))
                {
                    // Define Task Pane size on Action Pane Size.
                    var control = new ExportTablesMainView();
                    control_width  = control.Width;
                    control_height = control.Height;

                    // Init Task Pane
                    ctp = CustomTaskPaneFactory.CreateCustomTaskPane(control, "EXPORT SQL");

                    // Then dock state change event can not change size so we need to config size on floating mode first.
                    ctp.DockPosition = MsoCTPDockPosition.msoCTPDockPositionFloating;
                    ctp.Height       = control_height;
                    ctp.Width        = control_width;
                    // Change back to default Dock Position
                    ctp.DockPosition = MsoCTPDockPosition.msoCTPDockPositionLeft;
                    ctp.Width        = control_width;

                    ctp.DockPositionStateChange += Ctp_DockPositionStateChange;
                    ctp.VisibleStateChange      += Ctp_VisibleStateChange;

                    // Update Table List on first run
                    RefreshTableList();

                    // Add Task Pane on each workbook opened.
                    CTP_DICT.Add(paneID, ctp);
                }
                else
                {
                    // If Custom Task Pane already created, Call it from Dict and refresh Table List to be exported.
                    ctp = CTP_DICT.Single(x => x.Key == paneID).Value;
                    RefreshTableList();
                }
            }
            if (ctp != null)
            {
                ContainerControl ActPane = (ExportTablesMainView)ctp.ContentControl;
                var clr = ActPane.BackColor;
                if ((clr.B + clr.R + clr.G) / 3 <= 128)
                {
                    foreach (var LabelCtl in ActPane.Controls.OfType <Label>())
                    {
                        LabelCtl.ForeColor = Color.White;
                    }
                    foreach (var LabelCtl in ActPane.Controls.OfType <RadioButton>())
                    {
                        LabelCtl.ForeColor = Color.White;
                    }
                    foreach (var LabelCtl in ActPane.Controls.OfType <CheckBox>())
                    {
                        LabelCtl.ForeColor = Color.White;
                    }
                    foreach (var LabelCtl in ActPane.Controls.OfType <Panel>())
                    {
                        LabelCtl.ForeColor = Color.White;
                    }
                }
            }
        }
 public override CustomTaskPane CreateCustomTaskPane(Type userControlType, string title)
 {
     return(CustomTaskPaneFactory.CreateCustomTaskPane(userControlType, title));
 }
 public override CustomTaskPane CreateCustomTaskPane(object userControl, string title, object parent)
 {
     return(CustomTaskPaneFactory.CreateCustomTaskPane(userControl, title, parent));
 }
 public override CustomTaskPane CreateCustomTaskPane(string controlProgId, string title, object parent)
 {
     return(CustomTaskPaneFactory.CreateCustomTaskPane(controlProgId, title, parent));
 }
示例#22
0
 private void CreateDashboardTaskPane()
 {
     // Create and display a taskpane => to see the interaction between data in Wpf UI and ETK templates
     taskPane = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(DashboardPanel), "Dashboard Panel");
     taskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionBottom;
 }