public void ShowPane() { RemovePane(); UserControl userCtrl = null; string title = string.Empty; switch (CurrentMode) { case Mode.ANALYSIS_PERSHEET: userCtrl = new UCtrlPerSheetAnalysis(); title = UCtrlPerSheetAnalysis.TaskPaneTitle; break; case Mode.ANALYSIS_PERROW: userCtrl = new UCtrlPerRowAnalysis(); title = UCtrlPerRowAnalysis.TaskPaneTitle; break; default: break; } var customPane = CustomTaskPanes.Add(userCtrl, title); customPane.Width = userCtrl.Width + 300; customPane.Visible = true; }
private void Application_WorkbookActivate(Workbook Wb) { // This method is called whenever a workbook comes to the front // Does not necessarily need to be a workbook that is persisted on the disk var workbook = DataModel.Instance.WorkbookModels.Where(p => ReferenceEquals(p.Workbook, Wb)) .FirstOrDefault(); if (workbook == null) { workbook = new WorkbookModel(Wb); DataModel.Instance.WorkbookModels.Add(workbook); DataModel.Instance.CurrentWorkbook = workbook; DataModel.Instance.CurrentWorkbook.LoadExtraInformation(); /// create shared pane var SidebarContainer = new SidebarContainer(); var Sidebar = CustomTaskPanes.Add(SidebarContainer, "Sidebar"); SidebarContainer.Sidebar.DataContext = workbook; Sidebar.Width = 320; TaskPanes.Add(new Tuple <WorkbookModel, string>(workbook, "Sidebar"), Sidebar); //add selection changed event handler for ribbon Wb.Application.SheetSelectionChange += DataModel.Instance.WorkbookSelectionChangedEventHandler; } DataModel.Instance.CurrentWorkbook = workbook; }
internal ExecuteQuery InitializePane() { try { var gotPane = GetPane(); if (gotPane != null) { _customTaskPane = gotPane; return(_customTaskPane.Control as ExecuteQuery); } var executeQueryControl = new ExecuteQuery(); executeQueryControl.ExecuteCypher += ExecuteCypher; executeQueryControl.ConnectDatabase += ConnectDatabase; executeQueryControl.CreateNodes += CreateNodes; executeQueryControl.ExecuteSelection += ExecuteSelection; _customTaskPane = CustomTaskPanes.Add(executeQueryControl, "Execute Query"); _customTaskPane.Visible = true; return(executeQueryControl); } catch { return(null); } }
public void ShowPane() { RemovePane(); UserControl userCtrl; string title; switch (CurrentMode) { case Mode.AnalysisPerSheet: userCtrl = new UCtrlPerSheetAnalysis(); title = UCtrlPerSheetAnalysis.TaskPaneTitle; break; case Mode.AnalysisPerRow: userCtrl = new UCtrlPerRowAnalysis(); title = UCtrlPerRowAnalysis.TaskPaneTitle; break; default: throw new ArgumentOutOfRangeException(); } var customPane = CustomTaskPanes.Add(userCtrl, title); customPane.Width = userCtrl.Width + 300; customPane.Visible = true; }
internal ExecuteQuery InitializePane() { try { var gotPane = GetPane(); if (gotPane != null) { _customTaskPane = gotPane; return(_customTaskPane.Control as ExecuteQuery); } var executeQueryControl = new ExecuteQuery(); executeQueryControl.ExecuteCypher += ExecuteCypher; executeQueryControl.ConnectDatabase += ConnectDatabase; executeQueryControl.CreateNodes += CreateNodes; executeQueryControl.ExecuteSelection += ExecuteSelection; executeQueryControl.CreateRelationships += CreateRelationships; executeQueryControl.LoadButtonEventHandler += LoadAllNodes; executeQueryControl.SyncAllButtonEventHandler += SyncAllNodes; executeQueryControl.UpdateButtonEventHandler += UpdateAllNodes; _customTaskPane = CustomTaskPanes.Add(executeQueryControl, "Execute Query"); _customTaskPane.Visible = true; return(executeQueryControl); } catch { return(null); } }
public void CreateSheetNaviPane(bool ShowPane, Workbook workbook = null) { if (workbook == null) { if (Application.ActiveWorkbook != null) { workbook = Application.ActiveWorkbook; } else { return; } } if (!SheetNaviPaneDict.ContainsKey(workbook.Name)) { SheetNavi obj = new SheetNavi(workbook); SheetNaviObjDict[workbook.Name] = obj; SheetNaviObjDict[workbook.Name].BtnEnDisableChk(); SheetNaviPaneDict[workbook.Name] = CustomTaskPanes.Add(obj, "Sheet Navigation"); SheetNaviPaneDict[workbook.Name].DockPosition = Properties.Settings.Default.SheetNavi_DockPosition; SheetNaviPaneDict[workbook.Name].Width = 250; } if (ShowPane) { SheetNaviObjDict[workbook.Name].RefreshSheetList(); SheetNaviPaneDict[workbook.Name].Visible = true; } else { ; // false라고 해서 굳이 pane을 끄지는 않는다. } }
private void AddTaskPaneToWindow(Window window) { // Проверка панели задач в окне CustomTaskPane docPane = null; CustomTaskPane paneToRemove = null; foreach (var displayPane in _timerDisplayPanes) { try { if (displayPane.Window == window) { docPane = displayPane; break; } } catch (ArgumentNullException) { paneToRemove = displayPane; } } // Удалим сомнительную панель задач _timerDisplayPanes.Remove(paneToRemove); // Добавить панель задач к документу if (docPane == null) { var pane = CustomTaskPanes.Add(new TimerDisplayPane(_documentEditTimes), "Document Edit Timer", window); _timerDisplayPanes.Add(pane); pane.VisibleChanged += OnPaneVisibleChanged; } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { //TaskPanetest taskPanetest = new TaskPanetest();测试 //JudgeTaskPane judgeTaskPane = new JudgeTaskPane(); _JudgeTaskPane = CustomTaskPanes.Add(judgeTaskPane, "判断题"); _JudgeTaskPane.Width = 250; _JudgeTaskPane.Visible = false; Globals.ThisAddIn.Application.SlideSelectionChanged += new EApplication_SlideSelectionChangedEventHandler(isJudgeQuestionPPT); Globals.ThisAddIn.Application.SlideShowNextSlide += JudgeQuestion_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowBegin += JudgeQuestion_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowEnd += JudgeQuestion_SlideShowEnd; //单选题必要 _SingleChoiceTaskPane = CustomTaskPanes.Add(singleChoiceTaskPane, "单选题"); _SingleChoiceTaskPane.Width = 250; _SingleChoiceTaskPane.Visible = false; Globals.ThisAddIn.Application.SlideSelectionChanged += new EApplication_SlideSelectionChangedEventHandler(isSingleChoicePPT); Globals.ThisAddIn.Application.SlideShowNextSlide += Choice_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowBegin += Choice_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowEnd += Choice_SlideShowEnd; //多选题必要 _MultipleChoiceTaskPane = CustomTaskPanes.Add(multipleChoiceTaskPane, "多选题"); _MultipleChoiceTaskPane.Width = 250; _MultipleChoiceTaskPane.Visible = false; Globals.ThisAddIn.Application.SlideSelectionChanged += new EApplication_SlideSelectionChangedEventHandler(isMultipleChoicePPT); FillTaskPane FilltaskPane = new FillTaskPane(); _FillTaskPane = this.CustomTaskPanes.Add(FilltaskPane, "填空题"); _FillTaskPane.Width = 200; _FillTaskPane.Visible = false; Globals.ThisAddIn.Application.SlideSelectionChanged += new EApplication_SlideSelectionChangedEventHandler(IsFillQesttionPPT); Globals.ThisAddIn.Application.SlideShowNextSlide += Fill_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowBegin += Fill_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowEnd += Fill_SlideShowEnd; SimpleQuestionTaskPane SimpleQuestiontaskPane = new SimpleQuestionTaskPane(); _SimpleQuestionTaskPane = this.CustomTaskPanes.Add(SimpleQuestiontaskPane, "简答题"); _SimpleQuestionTaskPane.Width = 200; _SimpleQuestionTaskPane.Visible = false; Globals.ThisAddIn.Application.SlideSelectionChanged += new EApplication_SlideSelectionChangedEventHandler(IsSimpleQesttionPPT); Globals.ThisAddIn.Application.SlideShowNextSlide += Simple_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowBegin += Simple_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowEnd += Simple_SlideShowEnd; _VoteTaskPane = CustomTaskPanes.Add(voteTaskPane, "投票"); _VoteTaskPane.Width = 250; _VoteTaskPane.Visible = false; Globals.ThisAddIn.Application.SlideSelectionChanged += new EApplication_SlideSelectionChangedEventHandler(isVotePPT); Globals.ThisAddIn.Application.SlideShowNextSlide += Vote_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowBegin += Vote_SlideShowNextSlide; Globals.ThisAddIn.Application.SlideShowEnd += Vote_SlideShowEnd; }
private void AddTaskPane(MSWord.Document doc) { CustomTaskPane taskPane = CustomTaskPanes.Add(new LookupPane(), "German Grammar", doc.ActiveWindow); taskPane.Control.Tag = taskPane; taskPane.Width = paneWidth; taskPane.Visible = true; taskPane.Control.SizeChanged += TaskPane_SizeChanged; taskPaneMap.Add(doc, taskPane); }
private void ThisAddIn_NewWorkbook(Excel.Workbook wb) { myUserControl1 = new MyUserControl(); CustomTaskPane tempCTP; tempCTP = CustomTaskPanes.Add(myUserControl1, wb.FullName); tempCTP.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionLeft; tempCTP.Visible = false; CTPDictionary.Add(wb.FullName, tempCTP); }
private void ArticleBrowserAddIn_Startup(object sender, EventArgs e) { // Load the WPF ControlHost to be the design surface for WPF UI _host = new ControlHost(); _host.Form1_Load(this, EventArgs.Empty); // Add the name of the plugin _myTaskPane = CustomTaskPanes.Add(_host, "ArticleBrowser"); _myTaskPane.Visible = true; // Bring the control to front, so drag n drop element work _myTaskPane.Control.BringToFront(); }
private void ThisAddIn_Startup(object sender, EventArgs e) { _contentHost.WpfElementHost.Child = new SafeguardForm { // TODO: Create interface instances DataContext = new AddinViewModel(new SafeguardTestImpl(), new ExcelTestImpl()) }; var taskPane = CustomTaskPanes.Add(_contentHost, "Safeguard"); taskPane.Visible = true; }
public void CreateLogPane() { try { var removeItems = new List <CustomTaskPane>(); // remove non-visible panes foreach (var pane in CustomTaskPanes) { try { if (!pane.Visible) { removeItems.Add(pane); } } catch (Exception) { removeItems.Add(pane); } } foreach (var customTaskPane in removeItems) { CustomTaskPanes.Remove(customTaskPane); } var currWindow = Application.Windows[1]; var visible = false; foreach (var pane in CustomTaskPanes) { if (((Window)pane.Window).Hwnd == currWindow.Hwnd) { visible = true; LogPane = pane; Pane = LogPane.Control as LogPane; break; } } if (!visible) { Pane = new LogPane(); LogPane = CustomTaskPanes.Add(Pane, "TheySay Log", currWindow); } LogPane.Visible = true; } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { foreach (Outlook.Explorer explorer in Application.Explorers) { explorer.SelectionChange += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_SelectionChangeEventHandler(explorer_SelectionChange); } Application.Explorers.NewExplorer += new Microsoft.Office.Interop.Outlook.ExplorersEvents_NewExplorerEventHandler(Explorers_NewExplorer); Application.Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector); Application.ItemLoad += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemLoadEventHandler(Application_ItemLoad); myUserControl1 = new MyUserControl(); myCustomTaskPane = CustomTaskPanes.Add(myUserControl1, "My Task Pane"); myCustomTaskPane.Visible = true; }
private void Application_WorkbookActivate(Microsoft.Office.Interop.Excel.Workbook Wb) { // This method is called whenever a workbook comes to the front // Does not necessarily need to be a workbook that is persisted on the disk var workbook = DataModel.Instance.WorkbookModels.Where(p => ReferenceEquals(p.Workbook, Wb)).FirstOrDefault(); if (workbook == null) { workbook = new WorkbookModel(Wb); DataModel.Instance.WorkbookModels.Add(workbook); DataModel.Instance.CurrentWorkbook = workbook; DataModel.Instance.CurrentWorkbook.LoadExtraInformation(); /// create shared pane var sharedPaneContainer = new SharedPaneContainer(); var sharedPane = CustomTaskPanes.Add(sharedPaneContainer, "Inspection"); sharedPaneContainer.VisibleChanged += SharedPaneContainer_VisibleChanged; sharedPaneContainer.SharedPane.DataContext = workbook; sharedPane.Width = 340; TaskPanes.Add(new Tuple<WorkbookModel, string>(workbook, "shared Pane"), sharedPane); // create findings pane var violationViewContainer = new ViolationsViewContainer(); var taskPane = CustomTaskPanes.Add(violationViewContainer, "Violations"); violationViewContainer.VisibleChanged += FindingsPaneContainer_VisibleChanged; violationViewContainer.ViolationsView.DataContext = workbook; TaskPanes.Add(new Tuple<WorkbookModel, string>(workbook, "Violations"), taskPane); //create scenario detail pane var scenarioDetailPainContainer = new ScenarioDetailPaneContainer(); var scenarioDetailPane = CustomTaskPanes.Add(scenarioDetailPainContainer, "Scenario"); scenarioDetailPane.Width = 260; scenarioDetailPainContainer.VisibleChanged += ScenarioDetailPaneContainer_VisibleChanged; TaskPanes.Add(new Tuple<WorkbookModel, string>(workbook, "Scenario Details"), scenarioDetailPane); //add selection changed event handler for ribbon Wb.Application.SheetSelectionChange += DataModel.Instance.WorkbookSelectionChangedEventHandler; workbook.CellDefinitionChange += DataModel.Instance.CellDefinitionChangedEventHandler; } DataModel.Instance.CurrentWorkbook = workbook; }
private PaneAndControl CreatePane(Excel.Workbook wb) { var control = new VerticalTabHost(); control.Initialize(); // ActiveWindowがずれてしまうことがあるっぽいような var w = wb.Windows.OfType <Excel.Window>().FirstOrDefault() ?? Application.ActiveWindow; // ActiveWindowは保険 var pane = CustomTaskPanes.Add(control, "VTab", w); pane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionLeft; pane.Visible = true; pane.VisibleChanged += Pane_VisibleChanged; return(new PaneAndControl(pane, control)); }
/// <summary> /// Shows the task pane with the specified content. /// Either turns an existing pane visible or creates a new task pane /// </summary> public void ShowTaskPane(_Document document, UserControl content, string title) { if (document == null || content == null) { return; } var pane = FindTaskPane(document, content); if (pane == null) { pane = CustomTaskPanes.Add(content, title, document.ActiveWindow); pane.VisibleChanged += HandleCustomTaskPaneVisibleChanged; } pane.Visible = true; }
/// <summary> /// Método que crea un panel de validación de cruces por cada instancia de Excel /// </summary> /// <param name="wb"></param> private void Application_WorkbookActivate(Microsoft.Office.Interop.Excel.Workbook wb) { try { System.IO.FileInfo _ExcelFI = new System.IO.FileInfo(Globals.ThisAddIn.Application.ActiveWorkbook.Name); vdcUserControl = new VerificacionDeCruce(); myCustomTaskPane = CustomTaskPanes.Add(vdcUserControl, "Verificación " + _ExcelFI.Name); myCustomTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight; myCustomTaskPane.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange; myCustomTaskPane.Width = 515; myCustomTaskPane.Visible = false; } catch (Exception ex) { throw new Exception($"Error al instanciar el Task Panel de Validacion. [ThisAddIn].[Application_WorkbookActivate].[26]: {ex.Message}"); } }
/// <summary> /// add right panel into document /// </summary> public void AddProntoTaskPane() { try { TemplateInfo templateInfo = this.TemplateInfo; if (templateInfo.RightPanel != null) { CustomTaskPanes.Add(templateInfo.RightPanel.Control, Properties.Resources.ipm_RibbonTitle); } else { ProntoDocMarkup proMarkupCtrl = new ProntoDocMarkup(); // backup width before add int parentWidth = proMarkupCtrl.cboDomain.Parent.Width; int width = proMarkupCtrl.cboDomain.Width; // add to right panel of document templateInfo.RightPanel = CustomTaskPanes.Add(proMarkupCtrl, Properties.Resources.ipm_RibbonTitle); // after add, the width of domain control is reset to 0 then we need restore its. proMarkupCtrl.cboDomain.Parent.Width = parentWidth; proMarkupCtrl.cboDomain.Width = width; templateInfo.RightPanel.Width = 252; templateInfo.RightPanel.Visible = true; templateInfo.RightPanel.VisibleChanged += new EventHandler(ProntoTaskPane_VisibleChanged); if (ActiveDocument != null) { AddOrderContextMenu(); } } SetHeightForProntoDocMarkup(); } catch (BaseException srvExp) { ManagerException mgrExp = new ManagerException(ErrorCode.ipe_LoadResourceError); mgrExp.Errors.Add(srvExp); LogUtils.LogManagerError(mgrExp); } }
private void TaskPaneCreate(Excel.Workbook wb) { try { //создаем панель CustomTaskPane pane = CustomTaskPanes.Add(new PaneControl(), "Листы книги"); //сохраняем в каталоге ссылку на панель и статус отображения кноки if (wb != null) { PaneDictionary.Add(wb, new PaneInfoRecord { Pane = pane, IsCheked = false }); } } catch (Exception ex) { MessageBox.Show(string.Format("TargetSite = {0}\n\n HelpLink = {1}\n\n StackTrace = {2}\n\n Source = {3}" , ex.TargetSite.ToString(), ex.HelpLink, ex.StackTrace, ex.Source)); } }
public void DisplayBotControl() { if (_isVisible) { return; } try { var botControl = new BotControl(); var hostControl = new HostControl { ElementHost = { Child = botControl } }; var customPane = CustomTaskPanes.Add(hostControl, "Excel Bot"); customPane.Width = hostControl.Width; customPane.Visible = true; _isVisible = true; } catch (Exception e) { Console.WriteLine(e); } }
public void ResetSidebar() { try { if (TaskWidget != null) { CustomTaskPanes.Remove(TaskWidget); } RightWidget = new DockWidget(); TaskWidget = CustomTaskPanes.Add(RightWidget, getTypeName(App.ResourceType) + "库"); TaskWidget.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight; //int SH = Screen.PrimaryScreen.Bounds.Height; int SW = Screen.PrimaryScreen.Bounds.Width; int widths = 260; if (SW > 1600) { widths = 320; } TaskWidget.Width = widths; if (App.ResourceType != ResourceType.None) { RightWidget.ResetPageCount(); RightWidget.UpdateResourceList(); RightWidget.ResetButton(); TaskWidget.Visible = true; } else { TaskWidget.Visible = false; } } catch { } }
void ProcessDocument(Word.Document Doc) { settings = Properties.Settings.Default; string templateName = settings.TemplateName; wdDoc = Doc; Word.Template template = (Word.Template)Doc.get_AttachedTemplate(); templatePath = Path.GetDirectoryName(template.FullName); if (template.Name == templateName) { if (!connectedTaskPane) { ((Word.DocumentEvents_Event)Doc).Close += new Microsoft.Office.Interop.Word.DocumentEvents_CloseEventHandler(ThisAddIn_DocumentClose); ctlAnn = new AnnouncementsControl(); ctpAnnouncements = CustomTaskPanes.Add(ctlAnn, "Announcements"); int wid = Properties.Settings.Default.CTPWidth; if (wid != 0) { ctpAnnouncements.Width = wid; } ctlAnn.CreateAnnouncements += new AnnouncementsAddIn.AnnouncementsControl.CreateAnnouncementsHandler(ctlAnn_CreateAnnouncements); ctlAnn.SaveAnnouncements += new EventHandler(ctlAnn_SaveAnnouncements); ctlAnn.AddEditReminder += new AnnouncementsControl.AnnouncementsReminderHandler(ctlAnn_AddEditReminder); ctlAnn.PrintAnnouncements += new EventHandler(ctlAnn_PrintAnnouncements); ctlAnn.DateSelected += new AnnouncementsControl.DateSelectedHandler(ctlAnn_DateSelected); Doc.ActiveWindow.View.Zoom.PageFit = Microsoft.Office.Interop.Word.WdPageFit.wdPageFitBestFit; ConnectToExcel(); connectedTaskPane = true; } ctpAnnouncements.Visible = true; } else if (connectedTaskPane) { ctpAnnouncements.Visible = false; } }
/// <summary> /// Show the Alfresco pane /// </summary> /// <param name="Show"></param> private void ShowAlfrescoPane() { // Try to get active document Word.Document activeDoc = null; try { activeDoc = this.Application.ActiveDocument; } catch { activeDoc = null; } // Check Word UI mode if (this.Application.ShowWindowsInTaskbar) { // Multiple window mode Microsoft.Office.Tools.CustomTaskPane customTaskPane = this.FindActiveTaskPane(); if (customTaskPane == null) { AlfrescoPane alfrescoPane = new AlfrescoPane(); alfrescoPane.WordApplication = this.Application; alfrescoPane.DefaultTemplate = "wcservice/office/"; customTaskPane = CustomTaskPanes.Add(alfrescoPane, "Alfresco"); try { if (Application.ActiveDocument != null) { alfrescoPane.OnDocumentChanged(); } else { alfrescoPane.showHome(false); } } catch { // Almost certainlty as a result of no active document alfrescoPane.showHome(false); } } customTaskPane.Visible = true; customTaskPane.Width = ALFRESCO_PANE_WIDTH; customTaskPane.VisibleChanged += new EventHandler(CustomTaskPane_VisibleChanged); } else { // Single window mode } /* * if (m_CustomTaskPane == null) * { * m_CustomTaskPane = CustomTaskPanes.Add(m_AlfrescoPane, "Alfresco"); * m_CustomTaskPane.VisibleChanged += new EventHandler(CustomTaskPane_VisibleChanged); * } * * if (m_AlfrescoPane == null) * { * m_AlfrescoPane = new AlfrescoPane(); * m_AlfrescoPane.WordApplication = Application; * m_AlfrescoPane.DefaultTemplate = "wcservice/office/"; * } * * if (Show) * { * AddCustomTaskPane(); * m_CustomTaskPane.Visible = true; * m_CustomTaskPane.Width = ALFRESCO_PANE_WIDTH; * m_AlfrescoPane.Show(); * if (Application.ActiveDocument != null) * { * m_AlfrescoPane.OnDocumentChanged(); * } * else * { * m_AlfrescoPane.showHome(false); * } * } */ }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { tp = new TaskPane(); CustomTaskPanes.Add(tp, "Task Pane"); CustomTaskPanes[0].Visible = true; }
public CustomTaskPane AddCustomTaskPane(UserControl userControl, string name) { return(CustomTaskPanes.Add(userControl, name)); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { actionItemsForm = new ActionItemsDlg(); actionItemsTaskPane = CustomTaskPanes.Add(actionItemsForm, "Collaborator Action Items"); actionItemsTaskPane.Visible = true; }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { Trello = new Trello("1ed8d91b5af35305a60e169a321ac248"); MessageBus = new MessageBus(); var exportCardsControl = new ExportCardsControl(); var importCardsControl = new ImportCardsControl(); var authorizeForm = new AuthorizationDialog(); ExportCardsTaskPane = CustomTaskPanes.Add(exportCardsControl, "Export cards to Trello"); ExportCardsTaskPane.Width = 300; ExportCardsTaskPane.DockPositionRestrict = MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal; ImportCardsTaskPane = CustomTaskPanes.Add(importCardsControl, "Import cards from Trello"); ImportCardsTaskPane.Width = 300; ImportCardsTaskPane.DockPositionRestrict = MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal; TaskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); ExportCardsPresenter = new ExportCardsPresenter(exportCardsControl, Trello, new GridToNewCardTransformer(), TaskScheduler, MessageBus); ImportCardsPresenter = new ImportCardsPresenter(importCardsControl, MessageBus, Trello, TaskScheduler); AuthorizePresenter = new AuthorizePresenter(authorizeForm, Trello, MessageBus); Globals.Ribbons.TrelloRibbon.SetMessageBus(MessageBus); TryToAuthorizeTrello(); }