/// <summary> /// Raises the <see cref="SmartPartClosing"/> event. /// </summary> protected virtual void OnSmartPartClosing(WorkspaceCancelEventArgs e) { if (SmartPartClosing != null) { SmartPartClosing(this, e); } }
/// <summary> /// Raises the <see cref="SmartPartClosing"/> event using the specified /// event argument. /// </summary> /// <param name="e">The arguments to pass to the event.</param> protected void RaiseSmartPartClosing(WorkspaceCancelEventArgs e) { if (SmartPartClosing != null) { SmartPartClosing(this, e); } }
/// <summary> /// Raises the <see cref="SmartPartClosing"/> event. /// </summary> /// <param name="smartPart">The smart part that is being closed.</param> protected WorkspaceCancelEventArgs RaiseSmartPartClosing(object smartPart) { var cancelArgs = new WorkspaceCancelEventArgs(smartPart); RaiseSmartPartClosing(cancelArgs); return(cancelArgs); }
// Raise the SmartPartClosing event and use the returned value. private void FormClosing(object sender, FormClosingEventArgs e) { Control smartPart = GetSmartPart((IDockContent)sender); if (smartPart != null) { var wce = new WorkspaceCancelEventArgs(smartPart); OnSmartPartClosing(wce); e.Cancel = wce.Cancel; } }
/// <summary> /// Raises the <see cref="SmartPartClosing"/> event. /// </summary> /// <param name="smartPart">The smart part that is being closed.</param> protected WorkspaceCancelEventArgs RaiseSmartPartClosing(object smartPart) { if (smartPart is ElementHost) { smartPart = elementHosts.Unwrap((ElementHost)activeSmartPart); } var cancelArgs = new WorkspaceCancelEventArgs(smartPart); RaiseSmartPartClosing(cancelArgs); return(cancelArgs); }
/// <summary> /// Closes the smart part and resets (sets to null) the <see cref="ActiveSmartPart"/>. /// </summary> /// <exception cref="ArgumentException">The smartPart /// was not previously shown in the workspace.</exception> /// <exception cref="ArgumentException">The smartPart cannot be /// assigned to TSmartPart.</exception> public void Close(object smartPart) { //Guard.ArgumentNotNull(smartPart, "smartPart"); ThrowIfUnsupportedSP(smartPart); ThrowIfSmartPartNotShownPreviously((TSmartPart)smartPart); WorkspaceCancelEventArgs cancelArgs = RaiseSmartPartClosing(smartPart); if (cancelArgs.Cancel == false) { CloseInternal((TSmartPart)smartPart); } }
void IComposableWorkspace <Control, DockPanelSmartPartInfo> .RaiseSmartPartClosing(WorkspaceCancelEventArgs e) { OnSmartPartClosing(e); }