Пример #1
0
        protected void RunLaunchPad()
        {
            Wizard wizard = new Wizard();
            wizard.ShowDialog();
            if (wizard.SwitchModes)
            {
                RegistryHelper.getInstance().SetNeedToRunWizardAtStartup(true);
                RegistryHelper.getInstance().SetNeedToRunWizard(true);

                RunWizard();
            }
            else if (wizard.DialogResult == DialogResult.OK)
            {
                LaunchApplicationForTest(wizard, true);
            }
        }
Пример #2
0
        // Loads the project file, launches the aut, and then injects faults and sets limits.
        // Start app paused so that faults and limits are on as early as possible.
        // projectFileName - path to the project file
        private void OpenProject(String projectFileName)
        {
            XmlTextReader xReader = null;
            XmlValidatingReader validator = null;

            try
            {
                xReader = new XmlTextReader(projectFileName);
                validator = new XmlValidatingReader(xReader);
                validator.ValidationType = ValidationType.DTD;
                validator.ValidationEventHandler += new ValidationEventHandler(ValidationHandler);

                // any errors will cause an XmlException to be thrown
                while (validator.Read())
                {
                }

                XPathDocument doc = new XPathDocument(projectFileName);
                XPathNavigator nav = doc.CreateNavigator();

                // move to the project tag
                nav.MoveToFirstChild();
                bool hasMoreAUTs = false;

                if (nav.HasChildren)
                {
                    // move to the first aut tag
                    nav.MoveToFirstChild();
                    hasMoreAUTs = true;
                }

                while (hasMoreAUTs)
                {
                    Wizard wizard = new Wizard();

                    //Parse the wizard related project info
                    ParseAUTPre(nav, wizard);

                    bool appPaused = wizard.AppPaused;
                    wizard.AppPaused = true;
                    ProcessMdiWindow window = LaunchApplicationForTest(wizard, false);

                    // Parse the fault, limit, and test related project info
                    ParseAUTPost(nav, window);

                    if (window != null)
                    {
                        // add scheduled tests here

                        if (!appPaused)
                            this.applicationPauseMenuItem_Click(null, null);
                    }

                    // move to the next aut tag
                    hasMoreAUTs = nav.MoveToNext();
                }

                this.SavedProjectFileName = projectFileName;
            }
            finally
            {
                if (xReader != null)
                    xReader.Close();
                if (validator != null)
                    validator.Close();
            }
        }