private void Application_WorkbookActivate(Excel.Workbook Wb) { var wbCtp = WbCtp.Where(wb => wb.Key == Wb.FullName).FirstOrDefault().Value; if (wbCtp == null) { var taskPaneView = new TaskPaneView(); TaskPane = TaskPaneManager.GetTaskPane("A", "시트 목록", () => taskPaneView); TaskPane.Width = 250; TaskPane.VisibleChanged += new EventHandler(TaskPane_VisibleChanged); TaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionLeft; TaskPane.DockPositionChanged += new EventHandler(TaskPane_DockPositionChanged); var excel = Application; var anakinViewModel = new AnakinViewModel(excel); var anakinView = taskPaneView.AnakinView; anakinView.DataContext = anakinViewModel; WbCtp.Add(Wb.FullName, TaskPane); } else { TaskPane = wbCtp; } }
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 ThisAddIn_Startup(object sender, EventArgs e) { Application.WorkbookActivate += Application_WorkbookActivate; if (WbCtp.Count == 0) { var taskPaneView = new TaskPaneView(); TaskPane = TaskPaneManager.GetTaskPane("A", "시트 목록", () => taskPaneView); TaskPane.Width = 250; TaskPane.VisibleChanged += new EventHandler(TaskPane_VisibleChanged); TaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionLeft; TaskPane.DockPositionChanged += new EventHandler(TaskPane_DockPositionChanged); var excel = Application; var anakinViewModel = new AnakinViewModel(excel); var anakinView = taskPaneView.AnakinView; anakinView.DataContext = anakinViewModel; //WbCtp.Add( Wb.FullName, TaskPane); } else { //TaskPane = WbCtp; } //var taskPaneView = new TaskPaneView(); ////TaskPane = TaskPaneManager.GetTaskPane("A", "시트 목록", () => new TaskPaneView()); //TaskPane = TaskPaneManager.GetTaskPane("A", "시트 목록", () => taskPaneView); ////TaskPane = CustomTaskPanes.Add(taskPaneView, "시트 목록"); ////TaskPane.VisibleChanged += new EventHandler(TaskPane_VisibleChanged); //TaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionLeft; //TaskPane.DockPositionChanged += new EventHandler(TaskPane_DockPositionChanged); //var excel = Application; //var anakinViewModel = new AnakinViewModel(excel); //var anakinView = taskPaneView.AnakinView; //anakinView.DataContext = anakinViewModel; }