private void DocumentWindowChanged(Object sender, MonitorSelectionEventArgs e) { IMonitorSelectionService monitor = (IMonitorSelectionService)sender; IORMDesignerView testView = monitor.CurrentSelectionContainer as IORMDesignerView; this.CurrentDesignerView = (testView != null && testView.CurrentDesigner != null) ? testView : monitor.CurrentDocumentView as IORMDesignerView; }
/// <summary> /// Handles the SelectionChanged event of the MonitorSelection control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Microsoft.VisualStudio.Modeling.Shell.MonitorSelectionEventArgs"/> instance containing the event data.</param> private void MonitorSelection_SelectionChanged(object sender, MonitorSelectionEventArgs e) { if (((e.NewValue != null) && (e.NewValue != this)) && (e.NewValue is ISelectionService)) { ISelectionService selectionService = e.NewValue as ISelectionService; OnMonitorSelectionChanged(selectionService); } }
/// <summary> /// Handles the DocumentWindowChanged event on the IMonitorSelectionService /// </summary> private void DocumentWindowChanged(object sender, MonitorSelectionEventArgs e) { IMonitorSelectionService monitor = (IMonitorSelectionService)sender; DocDataType docData = monitor.CurrentDocument as DocDataType; DocViewType docView = monitor.CurrentDocumentView as DocViewType; if (!CurrentDocumentChanging(docData, docView)) { SetCurrentDocument(docData, docView); } }
/// <summary> /// Handles the SelectionChanged event on the IMonitorSelectionService /// </summary> private void MonitorSelectionChanged(object sender, MonitorSelectionEventArgs e) { IMonitorSelectionService monitor = (IMonitorSelectionService)sender; SelectionContainerType newContainer = monitor.CurrentSelectionContainer as SelectionContainerType; if (newContainer == null) { IProvideFrameVisibility visibility = myCurrentSelectionContainer as IProvideFrameVisibility; if (visibility == null || visibility.CurrentFrameVisibility == FrameVisibility.Hidden) { newContainer = monitor.CurrentDocumentView as SelectionContainerType; } } CurrentSelectionContainer = newContainer; }