public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var uiDel = new ThreadStart(() => { var window = new CancelWindow(); var outputCallBack = new OutputCallback(window.RecordOutput); RevitContext.BindOutput(outputCallBack); window.ShowDialog(); }); var t = new Thread(uiDel); t.SetApartmentState(ApartmentState.STA); t.Start(); return(Result.Succeeded); }
/// <summary> /// Shows the cancel window of the service. /// </summary> private void ShowCancelWindow() { // Shows the cancel window try { mCancelWindow = new CancelWindow(); mCancelWindow.MdiParent = base.Scenario.Form.MdiParent; mCancelWindow.Show(); } catch { mCancelWindow = null; } }
/// <summary> /// Hides the service cancel window. /// </summary> private void HideCancelWindow() { // Hides the cancel window try { mCancelWindow.Close(); mCancelWindow = null; } catch { } }