/// <summary> /// Occurs after one or more docking windows' states have changed. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param> private void OnDockSiteWindowsStateChanged(object sender, DockingWindowsEventArgs e) { var count = e.Windows.Count(); if (count == 1) { this.AppendMessage(String.Format("WindowsStateChanged: Title={0}, State={1}", e.Windows.First().Title, e.Windows.First().State)); } else { this.AppendMessage(String.Format("WindowsStateChanged: Count={0}, State={1}", count, e.Windows.First().State)); } }
/// <summary> /// Occurs before one or more docking windows are opened. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">The <c>DockingWindowsEventArgs</c> that contains data related to this event.</param> private void OnDockSiteWindowsOpening(object sender, DockingWindowsEventArgs e) { var count = e.Windows.Count(); if (count == 1) { this.AppendMessage(String.Format("WindowsOpening: Title={0}", e.Windows.First().Title)); } else { this.AppendMessage(String.Format("WindowsOpening: Count={0}", count)); } }
///////////////////////////////////////////////////////////////////////////////////////////////////// // NON-PUBLIC PROCEDURES ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Occurs before one or more docking windows are closed, allowing for cancellation of the close. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">The <c>DockingWindowsEventArgs</c> that contains data related to this event.</param> private void OnDockSiteWindowsClosing(object sender, DockingWindowsEventArgs e) { var documents = e.Windows.OfType <DocumentWindow>().ToArray(); if (documents.Any()) { var message = new StringBuilder("Are you sure you want to close:"); foreach (var document in documents) { message.Append("\r\n* " + document.FileName); } if (MessageBox.Show(message.ToString(), "Confirm Close", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.No) { e.Cancel = true; e.Handled = true; } } }