private void OnVisibilityChanged(SheetManagerTaskPane sheetManagerTaskPane) { if (!_lockVisibleChangedEventHandler) { _lockVisibleChangedEventHandler = true; Logger.Info("OnVisibilityChanged"); // Synchronize the visibility of all task panes. // We cannot use our own Visible property to accomplish this, // because accessing the property of the task pane that raised // the event causes an exception. _visible = sheetManagerTaskPane.Visible; foreach (SheetManagerTaskPane p in Panes.Values) { if (sheetManagerTaskPane != p) { p.Visible = _visible; } } Logger.Info("OnVisibilityChanged: Reraising VisibiltyChanged event"); EventHandler <SheetManagerEventArgs> h = VisibilityChanged; if (h != null) { h(this, new SheetManagerEventArgs(sheetManagerTaskPane)); } UserSettings.UserSettings.Default.SheetManagerVisible = Visible; _lockVisibleChangedEventHandler = false; } }
private void AttachToCurrentWindow() { // If the current window does not yet have our task pane, add it to it IntPtr currentHandle = Bovender.Win32Window.MainWindowHandleProvider(); if (!Panes.ContainsKey(currentHandle)) { Logger.Info("Attaching new WorksheetManager panel to window 0x{0:X08}", currentHandle); WorkbookViewModel viewModel; if (Instance.Default.IsSingleDocumentInterface) { // Create a new workbook view model only if this is an SDI application viewModel = new WorkbookViewModel(Instance.Default.ActiveWorkbook); } else { viewModel = _viewModel; } SheetManagerTaskPane tp = new SheetManagerTaskPane(viewModel, Width, Visible); tp.VisibilityChanged += (object sender, SheetManagerEventArgs args) => { OnVisibilityChanged(args.TaskPane); }; Panes.Add(currentHandle, tp); } else { Logger.Info("Window 0x{0:X08} already has a WorksheetManager panel", currentHandle); } }
public SheetManagerEventArgs(SheetManagerTaskPane sheetManagerTaskPane) { TaskPane = sheetManagerTaskPane; }