Пример #1
0
 RemoveAndFreeTestFuncs()
 {
     foreach (RevitLookupTestFuncs testFunc in m_tests)
     {
         RevitLookupTestFuncs.RemoveTestFuncsFromFramework(testFunc);
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        private void CreateAndAddTests()
        {
            m_tests.Add(new Test.TestElements(m_app));
            m_tests.Add(new Test.TestDocument(m_app));
            m_tests.Add(new Test.TestEStorage(m_app));
            m_tests.Add(new Test.TestGeometry(m_app));
            m_tests.Add(new Test.TestGraphicsStream(m_app));
            m_tests.Add(new Test.TestImportExport(m_app));
            m_tests.Add(new Test.TestUi(m_app));
            m_tests.Add(new Test.SDKSamples.SDKTestFuncs(m_app));
            m_tests.Add(new Test.TestApplication(m_app));

            foreach (RevitLookupTestFuncs testFunc in m_tests)
            {
                RevitLookupTestFuncs.AddTestFuncsToFramework(testFunc);
            }
        }