Example #1
0
        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;
            }
        }
Example #2
0
        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;
        }