public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems) { m_app = cmdData.Application; Snoop.CollectorExts.CollectorExt.m_app = cmdData.Application; Snoop.CollectorExts.CollectorExt.m_activeDoc = cmdData.Application.ActiveUIDocument.Document; // TBD: see note in CollectorExt.cs Result result; try { // Since we dont have an "App" as such, there is no // app-wide data - so just create tests for the duration // of the cmd and then destroy them CreateAndAddTests(); Test.TestForm form = new Test.TestForm(RevitLookupTestFuncs.RegisteredTestFuncs()); if (form.ShowDialog() == DialogResult.OK) { form.DoTest(); } result = Result.Succeeded; } catch (System.Exception e) { // we want to catch it so we can see the problem, otherwise it just silently bails out /*System.Exception innerException = e.InnerException; * * while (innerException != null) { * innerException = innerException.InnerException; * } * * msg = innerException.Message;*/ msg = e.Message; MessageBox.Show(msg); result = Result.Failed; } finally { // if an exception happens anywhere, clean up before quitting RemoveAndFreeTestFuncs(); } return(result); }
public Result Execute( ExternalCommandData cmdData, ref string msg, ElementSet elems ) { m_app = cmdData.Application; Snoop.CollectorExts.CollectorExt.m_app = cmdData.Application; Snoop.CollectorExts.CollectorExt.m_activeDoc = cmdData.Application.ActiveUIDocument.Document; // TBD: see note in CollectorExt.cs Result result; try { // Since we dont have an "App" as such, there is no // app-wide data - so just create tests for the duration // of the cmd and then destroy them CreateAndAddTests(); Test.TestForm form = new Test.TestForm( RevitLookupTestFuncs.RegisteredTestFuncs() ); if( form.ShowDialog() == DialogResult.OK ) form.DoTest(); result = Result.Succeeded; } catch( System.Exception e ) { // we want to catch it so we can see the problem, otherwise it just silently bails out /*System.Exception innerException = e.InnerException; while (innerException != null) { innerException = innerException.InnerException; } msg = innerException.Message;*/ msg = e.Message; MessageBox.Show( msg ); result = Result.Failed; } finally { // if an exception happens anywhere, clean up before quitting RemoveAndFreeTestFuncs(); } return result; }