private void SmartPartClosingEventHandler(object sender, WorkspaceCancelEventArgs e) { // SCC has detected the user wants to close a control ... object o1 = e.SmartPart; if (o1 is IDialogView) { IDialogView OmsControl = o1 as DialogView; if (OmsControl.IsOKToClose()) { // backend has already confirmed it is OK to close, go on and close ... e.Cancel = false; } else { // do not close the control yet, backend has to confirm it is OK first e.Cancel = true; object o2 = OmsControl.TrimControl; if (o2 is inUC) { inUC TrimControl = o2 as inUC; TrimControl.requestClose(); } } } }