public OneToManyCustomTaskPaneAdapter(CustomTaskPane original, object viewContext) { ViewContext = viewContext; this.original = original; customTaskPanes = new List<CustomTaskPane>(); Add(original); }
/// <summary> /// 생성자 /// </summary> /// <param name="Inspector"></param> public InspectorWrapper(Outlook.Inspector Inspector) { inspector = Inspector; ((Outlook.InspectorEvents_Event)inspector).Close += new Outlook.InspectorEvents_CloseEventHandler(InspectorWrapper_Close); taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new EmailTreeControll(), "for Wylie", inspector); taskPane.VisibleChanged += new EventHandler(TaskPane_VisibleChanged); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { Globals.ThisAddIn.Application.WindowSelectionChange += Application_WindowSelectionChange; paneInfo = new PaneShapeInfo(); pane = Globals.ThisAddIn.CustomTaskPanes.Add(paneInfo, "形状信息"); pane.Visible = true; }
public ExplorerWrapper(Explorer explorer) { _explorer = explorer; ((ExplorerEvents_Event)_explorer).Close += ExplorerWrapper_Close; taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new TaskPaneControl("Explorer", _count++), "My task pane", _explorer); taskPane.VisibleChanged += TaskPane_VisibleChanged; }
public InspectorWrapper(Inspector Inspector) { inspector = Inspector; ((InspectorEvents_Event)inspector).Close += InspectorWrapper_Close; taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new TaskPaneControl("Inspector", _count++), "My task pane", inspector); taskPane.VisibleChanged += TaskPane_VisibleChanged; taskPane.Visible = true; }
public static void DeleteCTP() { if (ctp != null) { // Could hide instead, by calling ctp.Visible = false; ctp.Delete(); ctp = null; } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { Application.PresentationBeforeClose += Application_PresentationBeforeClose; tp = new TaskPane(); ctp = this.CustomTaskPanes.Add(tp, Properties.Resources.TaskPaneTitle); ctp.Width = 300; ctp.VisibleChanged += new EventHandler(ctp_VisibleChanged); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { taskPaneView = new Details(); taskPane = this.CustomTaskPanes.Add(taskPaneView, "微博"); taskPane.Width = 300; taskPane.Visible = false; t.Elapsed += new System.Timers.ElapsedEventHandler(WexcelNotificate); t.AutoReset = true; t.Enabled = false; }
/// <summary> /// 창을 닫을때 inspector를 초기화 /// </summary> private void InspectorWrapper_Close() { if (taskPane != null) { Globals.ThisAddIn.CustomTaskPanes.Remove(taskPane); } taskPane = null; Globals.ThisAddIn.InspectorWrappers.Remove(inspector); ((Outlook.InspectorEvents_Event)inspector).Close -= new Outlook.InspectorEvents_CloseEventHandler(InspectorWrapper_Close); inspector = null; }
private void ShowActivitiesCTP() { if (TaskPane == null) { TaskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new WorkflowActivitiesControl(), "Workflow Activity Tracking"); TaskPane.Visible = true; } else { TaskPane.Visible = true; } }
private void ExplorerWrapper_Close() { if (taskPane != null) { Globals.ThisAddIn.CustomTaskPanes.Remove(taskPane); } taskPane = null; Globals.ThisAddIn.ExplorerWrappers.Remove(_explorer); ((ExplorerEvents_Event)_explorer).Close -= ExplorerWrapper_Close; _explorer = null; }
private void RemoveOrphanedTaskPanes() { try { for (int i = this.CustomTaskPanes.Count; i > 0; i--) { CustomTaskPane ctp = this.CustomTaskPanes[i - 1]; if (ctp.Window == null) { this.CustomTaskPanes.Remove(ctp); } } } catch { } }
protected override void InitializeShell() { base.InitializeShell(); //set current culture FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); mainRibbon.setController(this.Kernel.Get <IRibbonController>()); CustomTaskPane mainTaskPane = this.Kernel.Get <CustomTaskPane>(); mainTaskPane.Visible = true; Application app = Application.Current; }
public CustomTaskPane ShowTaskPane() { if (!Globals.ThisAddIn.CustomTaskPanes.Any()) { var service = new DocumentSerivce(Globals.ThisAddIn.Application.ActiveDocument); _mistakesListVM = new MistakesListViewModel(service, _spellChecker); var control = new WpfHost(); control.Host.Child = new MistakesList(_mistakesListVM); _taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(control, "Kurdspell"); } _taskPane.Visible = true; return(_taskPane); }
/// <summary> /// 显示读取SAP表数据的控件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tgbtnShowReadTable_Click(object sender, RibbonControlEventArgs e) { if (_ReaTablePane == null) { _ReadTableControl = new ReadTableControl(); _ReaTablePane = Globals.ThisAddIn.CustomTaskPanes.Add(_ReadTableControl, "读取SAP表内容"); _ReaTablePane.VisibleChanged += new EventHandler(taskPaneValue_VisibleChanged); _ReaTablePane.Visible = true; _ReaTablePane.Width = 300; } else { _ReaTablePane.Visible = ((RibbonToggleButton)sender).Checked; } }
private void btnGetTableInfo_Click(object sender, RibbonControlEventArgs e) { if (_GetTableMetaPane == null) { _GetTableMetaControl = new GetTableMetaControl(); _GetTableMetaPane = Globals.ThisAddIn.CustomTaskPanes.Add(_GetTableMetaControl, "读取SAP表元数据"); _GetTableMetaPane.VisibleChanged += new EventHandler(getTaBleMetaPane_VisibleChanged); _GetTableMetaPane.Visible = true; _GetTableMetaPane.Width = 300; } else { _GetTableMetaPane.Visible = ((RibbonToggleButton)sender).Checked; } }
private void InstantLookup_OnLemmaFound(object sender, List <Noun> found, MSWord.Document document) { CustomTaskPane ctp = null; taskPaneMap.TryGetValue(document, out ctp); if (ctp != null) { LookupPane lookupPane = (LookupPane)ctp.Control; lookupPane.Invoke((Action) delegate { lookupPane.Item = found[0]; lookupPane.lbxResults.DataSource = found; }); } }
/// <summary> /// 显示SAP Query控件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tgbtnQuery_Click(object sender, RibbonControlEventArgs e) { if (_SapQueryPane == null) { _SAPQueryControl = new SAPQueryControl(); _SapQueryPane = Globals.ThisAddIn.CustomTaskPanes.Add(_SAPQueryControl, "SAP Query"); _SapQueryPane.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionBottom; _SapQueryPane.VisibleChanged += new System.EventHandler(_SapQueryPane_VisibleChanged); _SapQueryPane.Visible = true; } else { _SapQueryPane.Visible = ((RibbonToggleButton)sender).Checked; } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { processingUtility = new MailProcessingUtilities(); inspectors = this.Application.Inspectors; inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector); foreach (Outlook.Inspector inspector in inspectors) { Inspectors_NewInspector(inspector); } tagManagementControl = new TagManagementControl(); tagManagementTaskPane = this.CustomTaskPanes.Add(tagManagementControl, global::CELA_Email_Tags_Outlook_Plugin.CELA_Custom_Ribbon.tagManagmentDisplayPanelTitleText); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { m_control.AutoSize = true; m_panel = CustomTaskPanes.Add(m_control, "Cell Art"); m_panel.Width = m_control.PreferredSize.Width + 10; m_panel.VisibleChanged += (snd, ev) => { var r = Globals.Ribbons.GetRibbon(typeof(MyRibbon)); var ribbon = r as MyRibbon; if (ribbon != null) { ribbon.ChangeStatus(m_panel.Visible); } }; }
protected override void ExecuteAction(string ribbonId) { LoadingDialogBox splashView = new LoadingDialogBox(); splashView.Show(); AzureAccountStorageService.LoadUserAccount(); WatsonAccountStorageService.LoadUserAccount(); AudioSettingStorageService.LoadAudioSettingPreference(); splashView.Close(); this.RegisterTaskPane(typeof(ELearningLabTaskpane), ELearningLabText.ELearningTaskPaneLabel, ELearningTaskPaneVisibleValueChangedEventHandler); CustomTaskPane eLearningTaskpane = this.GetTaskPane(typeof(ELearningLabTaskpane)); eLearningTaskpane.Visible = !eLearningTaskpane.Visible; }
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; } }
private void ListCaptionsForTaskPaneWindows(String context) { try { for (int i = this.CustomTaskPanes.Count; i > 0; i--) { CustomTaskPane ctp = this.CustomTaskPanes[i - 1]; Word.Window ctpWindow = (Word.Window)ctp.Window; System.Diagnostics.Debug.Write(context + " i " + i + " tcp WindowCaption: " + ctpWindow.Caption + "\n"); } } catch (Exception ex) { } }
private void open_DbfExportTaskPane(object sender, RibbonControlEventArgs e) { if (ucDbfExport == null) { ucDbfExport = new UC_DbfExport(); } if (ucDbfCustomTaskPane == null) { ucDbfCustomTaskPane = Globals.ThisAddIn.CustomTaskPanes.Add(ucDbfExport, "DBF导出任务"); ucDbfCustomTaskPane.Width = 300; } ucDbfCustomTaskPane.Visible = !ucDbfCustomTaskPane.Visible; }
public InspectorWrapper(MSOutlook.Inspector Inspector, InstantLookup<MSOutlook.Inspector> InstantLookup) { inspector = Inspector; ((MSOutlook.InspectorEvents_Event)inspector).Activate += InspectorWrapper_Activate; ((MSOutlook.InspectorEvents_Event)inspector).Deactivate += InspectorWrapper_Deactivate; ((MSOutlook.InspectorEvents_Event)inspector).Close += InspectorWrapper_Close; instantLookup = InstantLookup; instantLookup.OnLemmaFound += InstantLookup_OnLemmaFound; taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new LookupPane(), "German Grammar", inspector); taskPane.Visible = Properties.Settings.Default.LookupPaneVisible; taskPane.Width = Properties.Settings.Default.LookupPaneWidth; taskPane.Control.Tag = taskPane; taskPane.Control.SizeChanged += Control_SizeChanged; }
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; } }
private void btnGetTableInfo_Click(object sender, RibbonControlEventArgs e) { if (_GetTableMetaPane == null) { _GetTableMetaControl = new GetTableMetaControl(); _GetTableMetaPane = Globals.ThisAddIn.CustomTaskPanes.Add(_GetTableMetaControl, "读取SAP表元数据"); _GetTableMetaPane.VisibleChanged += new EventHandler(getTaBleMetaPane_VisibleChanged); _GetTableMetaPane.Visible = true; _GetTableMetaPane.Width = 300; } else { _GetTableMetaPane.Visible = ((RibbonToggleButton)sender).Checked; } }
protected override void ExecuteAction(string ribbonId) { this.RegisterTaskPane(typeof(PositionsPane), PositionsLabText.TaskPanelTitle); CustomTaskPane positionsPane = this.GetTaskPane(typeof(PositionsPane)); // if currently the pane is hidden, show the pane if (!positionsPane.Visible) { // fire the pane visble change event positionsPane.Visible = true; } else { positionsPane.Visible = false; } }
private void EditAddressList() { if (addressEditorPane == null) { var paneManager = _serviceLocator.GetInstance <IPaneManager <CustomTaskPane> >(); addressEditorPane = paneManager.CreateCustomTaskPane <AddressListView, AddressListViewModel>("Адрессный список"); addressEditorPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionFloating; addressEditorPane.Width = 600; addressEditorPane.Height = 450; addressEditorPane.Visible = true; } else { addressEditorPane.Visible = true; } }
private void Inspectors_NewInspector(Outlook.Inspector inspector) { // We will add our custom task pane to the new inspector. if (inspector.CurrentItem is Outlook.MailItem || inspector.CurrentItem is Outlook.AppointmentItem || inspector.CurrentItem is Outlook.TaskItem || inspector.CurrentItem is Outlook.ContactItem) { // Create the custom task pane and make it initially invisible. MyTaskPane mtp = new MyTaskPane(); CustomTaskPane ctp = this.CustomTaskPanes.Add(mtp, "Browser", inspector); ctp.Visible = false; ctp.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionBottom; mtp.ParentCustomTaskPane = ctp; } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { /*vlal20180323: Part1 * var messageBox = MessageBox.Show("Hello, World!"); */ //vlal20180323: Part2 var taskPaneView = new TaskPaneView(); this.taskPane = this.CustomTaskPanes.Add(taskPaneView, "VlalV"); this.taskPane.Visible = false; var vlalViewModel = new VlalVViewModel(); var vlalView = taskPaneView.VlalVView; vlalView.DataContext = vlalViewModel; }
private void switchPanelTab_Click(object sender, RibbonControlEventArgs e) { CustomTaskPane customTaskPane = Globals.ThisAddIn.CustomTaskPane; customTaskPane.Visible = true; TabControl tabMainControl = (TabControl)customTaskPane.Control.Controls.Find("tabMainControl", true).FirstOrDefault(); if (tabMainControl.SelectedIndex == 0) { tabMainControl.SelectTab(1); } else { tabMainControl.SelectTab(0); } }
private void EditRegexList() { if (regexEditorPane == null) { var paneManager = _serviceLocator.GetInstance <IPaneManager <CustomTaskPane> >(); regexEditorPane = paneManager.CreateCustomTaskPane <RegexListView, RegexListViewModel>("Регулярные выражения"); regexEditorPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionFloating; regexEditorPane.Width = 600; regexEditorPane.Height = 450; regexEditorPane.Visible = true; } else { regexEditorPane.Visible = true; } }
public InspectorWrapper(MSOutlook.Inspector Inspector, InstantLookup <MSOutlook.Inspector> InstantLookup) { inspector = Inspector; ((MSOutlook.InspectorEvents_Event)inspector).Activate += InspectorWrapper_Activate; ((MSOutlook.InspectorEvents_Event)inspector).Deactivate += InspectorWrapper_Deactivate; ((MSOutlook.InspectorEvents_Event)inspector).Close += InspectorWrapper_Close; instantLookup = InstantLookup; instantLookup.OnLemmaFound += InstantLookup_OnLemmaFound; taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new LookupPane(), "German Grammar", inspector); taskPane.Visible = Properties.Settings.Default.LookupPaneVisible; taskPane.Width = Properties.Settings.Default.LookupPaneWidth; taskPane.Control.Tag = taskPane; taskPane.Control.SizeChanged += Control_SizeChanged; }
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; } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { // 初始化右侧解析框 UCForRichText richTextBox = new UCForRichText(); _MyCustomTaskPane = this.CustomTaskPanes.Add(richTextBox, "解析结果"); _MyCustomTaskPane.Width = 800; _MyCustomTaskPane.Visible = false; //获取右键菜单对象mzBar Office.CommandBar mzBar = Application.CommandBars["Text"]; //重置菜单 mzBar.Reset(); //获取右键菜单的控制对象 Office.CommandBarControls bars = mzBar.Controls; /*已被mzBar.Reset();替代,用于除去其余标签为"autoAnswer"的菜单项 foreach (Office.CommandBarControl temp_contrl in bars) { string t = temp_contrl.Tag.Trim(); if (t.Equals("autoAnswer")) { temp_contrl.Delete(); } } */ //在右键菜单列表添加新的菜单项 Office.CommandBarControl comControl = bars.Add(Office.MsoControlType.msoControlButton, missing, missing, missing, true); //添加自己的菜单项 //将该菜单项转为按钮可点击模式 Office.CommandBarButton comButton = comControl as Office.CommandBarButton; if (comControl != null) { comButton.Tag = "autoAnswer";//添加标签"autoAnswer" comButton.Caption = "选择答案";//设置文本 comButton.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; comButton.Enabled = false;//设置不可点击 //name = comButton.accName; //comButton.Click += new Office._CommandBarButtonEvents_ClickEventHandler(_RightBtn_Click); } Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument); vstoDoc.BeforeDoubleClick += new Microsoft.Office.Tools.Word.ClickEventHandler(ThisDocument_BeforeDoubleClick); this.Application.WindowBeforeRightClick += new Word.ApplicationEvents4_WindowBeforeRightClickEventHandler(Application_WindowBeforeRightClick); }
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); } } }
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; } }
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; } }
private NotFoundViewModel OpenNotFoundPane() { if (notFoundPane != null) { notFoundPane.Visible = true; } else { var paneManager = _serviceLocator.GetInstance <IPaneManager <CustomTaskPane> >(); notFoundPane = paneManager.CreateCustomTaskPane <NotFoundView, NotFoundViewModel>("Панель поиска"); notFoundPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionLeft; notFoundPane.Width = 800; notFoundPane.Visible = true; } return(GetViewModelNotFoundPane()); }
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; } }
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; } }
private void AddAllTaskPanes() { foreach (Word.Window window in this.Application.Windows) { CustomTaskPane ctp = this.CustomTaskPanes.SingleOrDefault(t => t.Window == window); if (ctp == null) { WordConnectorPane taskPaneControl1 = new WordConnectorPane(); IConnectorMainView connectorExplorer = ((System.Windows.Forms.Integration.ElementHost)taskPaneControl1.Controls[0]).Child as IConnectorMainView; ApplicationContext.SetApplicationManager(new WordConnectorManager(Application, connectorExplorer)); Microsoft.Office.Tools.CustomTaskPane taskPaneValue = this.CustomTaskPanes.Add(taskPaneControl1, "Sobiens Office Connector", window); taskPaneValue.VisibleChanged += new EventHandler(taskPaneValue_VisibleChanged); } } }
protected override void ExecuteAction(string ribbonId) { this.RegisterTaskPane(typeof(CustomShapePane), ShapesLabText.TaskPanelTitle); CustomTaskPane shapesLabPane = this.GetTaskPane(typeof(CustomShapePane)); if (shapesLabPane == null) { return; } // toggle pane visibility shapesLabPane.Visible = !shapesLabPane.Visible; CustomShapePane customShapePane = shapesLabPane.Control as CustomShapePane; customShapePane.InitCustomShapePaneStorage(); }
private void InspectorWrapper_Close() { taskPane.Control.SizeChanged -= Control_SizeChanged; Globals.ThisAddIn.CustomTaskPanes.Remove(taskPane); taskPane = null; instantLookup.Paused = true; instantLookup.OnLemmaFound -= InstantLookup_OnLemmaFound; instantLookup = null; Globals.ThisAddIn.InspectorWrappers.Remove(inspector); ((MSOutlook.InspectorEvents_Event)inspector).Close -= InspectorWrapper_Close; ((MSOutlook.InspectorEvents_Event)inspector).Deactivate -= InspectorWrapper_Deactivate; ((MSOutlook.InspectorEvents_Event)inspector).Activate -= InspectorWrapper_Activate; inspector = null; Properties.Settings.Default.Save(); //need to do this here, as I can't do it in the shutdown of the addon... }
public void Add(CustomTaskPane customTaskPane) { if (disposed) return; //Sync new task pane's properties up customTaskPane.Visible = original.Visible; customTaskPane.DockPosition = original.DockPosition; if (original.DockPosition != Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionTop && original.DockPosition != Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionBottom) { customTaskPane.Width = original.Width; } if (original.DockPosition != Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionLeft && original.DockPosition != Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight) { customTaskPane.Height = original.Height; } customTaskPanes.Add(customTaskPane); customTaskPane.DockPositionChanged += CustomTaskPaneDockPositionChanged; customTaskPane.VisibleChanged += CustomTaskPaneVisibleChanged; }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { _ctp = Globals.ThisAddIn.CustomTaskPanes.Add(new Photo_Viewer_User_Control(), "Photo Viewer"); }
/// <summary> /// Start handling the visibility events for a particular taskpane. /// </summary> /// <param name="ctp">A CustomTaskPane specifying the taskpane whose events we want to handle.</param> internal void ConnectTaskPaneEvents(CustomTaskPane ctp) { m_appEvents.ConnectTaskPaneEvents(ctp); }
/// <summary> /// 显示读取SAP表数据的控件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tgbtnShowReadTable_Click(object sender, RibbonControlEventArgs e) { if (_ReaTablePane == null) { _ReadTableControl = new ReadTableControl(); _ReaTablePane = Globals.ThisAddIn.CustomTaskPanes.Add(_ReadTableControl, "读取SAP表内容"); _ReaTablePane.VisibleChanged += new EventHandler(taskPaneValue_VisibleChanged); _ReaTablePane.Visible = true; _ReaTablePane.Width = 300; } else { _ReaTablePane.Visible = ((RibbonToggleButton)sender).Checked; } }
void DisposeTaskPane(CustomTaskPane c) { c.VisibleChanged -= CustomTaskPaneVisibleChanged; c.DockPositionChanged -= CustomTaskPaneDockPositionChanged; try { c.Dispose(); } catch (ObjectDisposedException) { } customTaskPanes.Remove(c); }
/// <summary> /// 显示SAP Query控件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tgbtnQuery_Click(object sender, RibbonControlEventArgs e) { if (_SapQueryPane == null) { _SAPQueryControl = new SAPQueryControl(); _SapQueryPane = Globals.ThisAddIn.CustomTaskPanes.Add(_SAPQueryControl, "SAP Query"); _SapQueryPane.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionBottom; _SapQueryPane.VisibleChanged += new System.EventHandler(_SapQueryPane_VisibleChanged); _SapQueryPane.Visible = true; } else { _SapQueryPane.Visible = ((RibbonToggleButton)sender).Checked; } }
public void DockPositionStateChange(CustomTaskPane pane1) { if (this.m_DockPositionStateChangeDelegate != null) { this.m_DockPositionStateChangeDelegate(pane1); } }
public PaneAndControl(CustomTaskPane pane, VerticalTabHost control) { Pane = pane; Control = control; }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { //添加浏览器控件 webbrowserPane = new WebbrowserPane(); taskpane = this.CustomTaskPanes.Add(webbrowserPane, "网页浏览器"); taskpane.Width = 400; taskpane.Visible = false; //添加菜单按钮 RemoveAddedMenuItems(); AddRightClickMenuItems(); //添加鼠标右键的事件 this.Application.WindowBeforeRightClick += new Word.ApplicationEvents4_WindowBeforeRightClickEventHandler(Application_WindowBeforeRightClick); }
/// <summary> /// Adds a new item to workbookTaskPaneMap dictionary /// </summary> /// <param name="WorkbookName"></param> /// <param name="customTaskPane"></param> void AddToWorkbookTaskPaneMap(string WorkbookName, CustomTaskPane customTaskPane) { //TODO: Throw exception //if (workbookTaskPaneMap.ContainsKey(WorkbookName)) workbookTaskPaneMap.Add(WorkbookName, customTaskPane); }
/// <summary> /// Connect the VisibleChanged event for an instance of our task pane. /// </summary> /// <param name="ctp">A CustomTaskPane specifying the new instance of the task pane.</param> public void ConnectTaskPaneEvents(CustomTaskPane ctp) { ctp.VisibleChanged += new System.EventHandler(ctp_VisibleChange); }
public void InitData(Excel.Workbook workbook, Excel.Worksheet worksheet, CustomTaskPane TaskPane, SheetConfig ShtCfg = null) { this.Wb = workbook; this.ws = worksheet; this.myTaskPane = TaskPane; ((DocEvents_Event)ws).Activate += ws_Activate; this.ws.Deactivate += ws_Deactivate; this.ws.Change += ws_Change; if (ShtCfg != null) { foreach (var col in ShtCfg.ColumnConfigData) { if (col != null) { dataGridView1.Rows.Add(col.FieldName, col.FieldType, col.LimitMin, col.LimitMax, col.Export, col.Primarykey); } } } else { ShtCfg = new SheetConfig(); ShtCfg.Name = this.ws.Name; } this.SheetCfg = ShtCfg; this.ws_Change(this.ws.Cells[1, 1]); // 此时可能存在不合法数据(例如列名重复或列与配置不符),所以要按单元格内容变化的逻辑处理一次 }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { favoritesControl = new FavoritesControl(); favoritesPane = CustomTaskPanes.Add(favoritesControl, "Favorites"); favoritesPane.VisibleChanged += favoritesPane_VisibleChanged; }
void DisposeTaskPane(CustomTaskPane c) { c.VisibleChanged -= CustomTaskPaneVisibleChanged; c.DockPositionChanged -= CustomTaskPaneDockPositionChanged; try { var control = c.Control; foreach (var control1 in control.Controls.OfType<ElementHost>().ToArray()) { control1.Child = null; control1.Dispose(); control1.Parent = null; control.Controls.Remove(control1); } } catch (ObjectDisposedException) { } customTaskPanes.Remove(c); }
public void VisibleStateChange(CustomTaskPane pane1) { if (this.m_VisibleStateChangeDelegate != null) { this.m_VisibleStateChangeDelegate(pane1); } }