private void initPanel() { if (RightPanel != null) { return; } CustomTaskPaneCollection CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "CustomTaskPanes", "CustomTaskPanes", this); proMarkupCtrl = new ProntoExcelMarkup(); proMarkupCtrl.tabControl1.SelectedIndex = 0; RightPanel = CustomTaskPanes.Add(proMarkupCtrl, "Pronto Excel"); RightPanel.Width = 252; //update exported tree foreach (ExportItemMap item in export.exportItems) { TreeNode node = proMarkupCtrl.treeView2.Nodes[0].Nodes.Add(item.treeNodeName); if (item.mapType == ProntoDoc.Framework.CoreObject.MapType.Table) { foreach (TableColumnMap col in item.tabCols) { node.Nodes.Add(col.treeNodeName); } } } }
private void button1_Click(object sender, RibbonControlEventArgs e) { CustomTaskPaneCollection CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "CustomTaskPanes", "CustomTaskPanes", this); ProntoExcelMarkup proMarkupCtrl = new ProntoExcelMarkup(); CustomTaskPane RightPanel = CustomTaskPanes.Add(proMarkupCtrl, "ProntoExcel"); RightPanel.Width = 252; RightPanel.Visible = true; }
public void btnStartPronto_Click(Office.IRibbonControl control) { if (customTaskPane == null) { CustomTaskPaneCollection CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "CustomTaskPanes", "CustomTaskPanes", this); customTaskPane = CustomTaskPanes.Add(new CustomTaskPaneControl(), "Pronto Mobile"); customTaskPane.Width = 252; } customTaskPane.Visible = true; }
private CustomTaskPane createMainTaskPane() { WpfControlHost controllHost = new WpfControlHost(); controllHost.WpfElementHost.HostContainer.Children.Add((UIElement)this.Kernel.Get <Shell>()); CustomTaskPane mainTaskPane = customTaskPaneCollection.Add(controllHost, Properties.Resources.mainTaskPane_title); mainTaskPane.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight; mainTaskPane.Width = 400; return(mainTaskPane); }
private ConfigPane(Object inWin, Object inDoc, CustomTaskPaneCollection inCustomTaskPanes, string version) { const int OrigWidth = 363; logger.ConditionalDebug("ConfigPane"); theWin = inWin; theDoc = inDoc; customTaskPanes = inCustomTaskPanes; confContr = new ConfigControl(inWin, inDoc, version); configTaskPane = customTaskPanes.Add(confContr, ConfigBase.ColorizationName, theWin); configTaskPane.Width = ((int)(OrigWidth * confContr.ScaleFactor)) + 2; }
public CustomTaskPane GetMyPane() { Word.Window window = Globals.ThisAddIn.Application.ActiveWindow; foreach (CustomTaskPane ctp in m_MyPanes) { if (ctp.Title == "我的工具" && ctp.Window == window) { return(ctp); } } return(m_MyPanes.Add(new ToolsPanel(), "我的工具", window)); }
public static Microsoft.Office.Tools.CustomTaskPane AddTaskPane(System.Windows.Forms.UserControl taskPane, string name, CustomTaskPaneCollection customTaskPanes) { //PLLog.Trace3("Enter", Common.PROJECT_NAME); CustomTaskPane ctp = default(CustomTaskPane); ctp = customTaskPanes.Add(taskPane, name); ctp.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight; ctp.Visible = true; //PLLog.Trace3("Exit", System.Data.Common.PROJECT_NAME); return(ctp); }
public void CreateTaskpaneInstance(string userControlName, int width, int height, Microsoft.Office.Core.MsoCTPDockPosition dockPosition) { CustomTaskPane customTaskpane; // Add a custom taskpane dynamic userControl = System.Activator.CreateInstance(null, String.Format("{0}.{1}", this.GetType().Namespace, userControlName)).Unwrap(); customTaskpane = m_tpc.Add(userControl, string.Format("DDPI Custom Taskpane {0}", m_tpc.Count + 1)); customTaskpane.DockPosition = dockPosition; try { if (width != 0 && (dockPosition == Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionFloating || dockPosition == Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionLeft || dockPosition == Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight)) { customTaskpane.Width = width; } } catch (System.Runtime.InteropServices.COMException except) { MessageBox.Show(except.Message); } try { if (height != 0 && (dockPosition == Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionFloating || dockPosition == Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionBottom || dockPosition == Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionTop)) { customTaskpane.Height = height; } } catch (System.Runtime.InteropServices.COMException except) { MessageBox.Show(except.Message); } customTaskpane.DockPositionChanged += new System.EventHandler(CustomTaskPaneDockChangeHandler); customTaskpane.Visible = true; // Set a ref to the custom taskpane if the method exists try { userControl.SetCustomTaskpane(ref customTaskpane); } catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException) { } }
protected override void OnButtonAction(XRibbonButton xRibbonButton, RibbonEventArgs e) { Log.Debug("---VersionCommand--Begin:" + DateTime.Now.ToLongTimeString()); CustomTaskPaneCollection panes = SceneContext.Instance.CustomTaskPanesAdmin.CustomTaskPanes; int panesCount = panes.Count; Log.Debug("---VersionCommand--01:" + DateTime.Now.ToLongTimeString()); if (panesCount == 0) { var pane = new CustomPane(); Log.Debug("---VersionCommand--02:" + DateTime.Now.ToLongTimeString()); var host = new PaneDecorator(pane); Log.Debug("---VersionCommand--03:" + DateTime.Now.ToLongTimeString()); panes.Add(host, "版本信息"); Log.Debug("---VersionCommand--04:" + DateTime.Now.ToLongTimeString()); } CustomTaskPane taskPane = panes[0]; taskPane.VisibleChanged += new EventHandler(taskPane_VisibleChanged); taskPane.Width = 430; taskPane.Visible = true; }
private CustomTaskPane AddAlertTaskPane(CustomTaskPaneCollection customTaskPanes, WsInspector inspector) { if (_alertTaskPanes.ContainsKey(inspector.Id)) return _alertTaskPanes[inspector.Id]; var alertUserControl = new AlertBarControl(inspector) { Visible = true }; alertUserControl.ShowAlertBar += OnShowAlertBar; alertUserControl.AlertBarClicked += OnAlertBarClicked; var alertTaskPane = customTaskPanes.Add(alertUserControl, " ", inspector.UnSafeInspector); alertUserControl.TaskPane = alertTaskPane; alertTaskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionTop; alertTaskPane.Height = Utils.AdjustDimensionWithDpiHook(55); alertTaskPane.Visible = false; _alertTaskPanes.TryAdd(inspector.Id, alertTaskPane); return alertTaskPane; }
public void AddProtectTaskPanes(WsInspector inspector, bool hookSendButton = true, bool visible = false) { try { var hook = new InspectorHook(inspector); WaitForItemSend(hook); _customTaskPanes = Globals.ThisAddin.GetCustomTaskPaneCollection(); var alertBar = AddAlertTaskPane(_customTaskPanes, inspector); var ctp = new ProtectTaskPane(inspector, (AlertBarControl)alertBar.Control, OnStatusUpdate) { Dock = DockStyle .Fill }; ctp.InspectorHook = hook; CustomTaskPane taskPane = _customTaskPanes.Add(ctp, "Workshare Protect", inspector.UnSafeInspector); taskPane.Visible = visible; taskPane.Width = Utils.AdjustDimensionWithDpiHook(350); taskPane.VisibleChanged += TaskPaneVisibleChanged; taskPane.DockPositionChanged += OnDockPositionChanged; taskPane.DockPosition = (MsoCTPDockPosition)OptionApi.GetInt("InteractiveProtectDockPosition"); if (_protectTaskPanes.TryAdd(inspector.Id, taskPane) && hookSendButton) { hook.ActionQueueController = ctp.Presenter.ActionQueueController; ctp.InitializeMailItemWithAttachments(); } } catch (Exception e) { Logger.LogError(e); throw; } }