Beispiel #1
0
 /// <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);
     }
 }
Beispiel #3
0
        /// <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);
        }
Beispiel #4
0
        // 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);
        }
Beispiel #6
0
        /// <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);
            }
        }
Beispiel #7
0
 void IComposableWorkspace <Control, DockPanelSmartPartInfo> .RaiseSmartPartClosing(WorkspaceCancelEventArgs e)
 {
     OnSmartPartClosing(e);
 }