예제 #1
0
 private void Form1_WizardCompleting(object sender, CancellableWizardEventArgs e)
 {
     e.Cancel = MessageBox.Show("Cancel?", "Test", MessageBoxButtons.YesNo) == DialogResult.Yes;
     if (!e.Cancel)
     {
         string mainFileNameTemp = Path.GetTempFileName();
         string stubFileNameTemp = Path.GetTempFileName();
         try
         {
             TraceFileProcessor tfp = new TraceFileProcessor();
             tfp.ProcessTraceFile("WizardTester", e.Data.TraceFile, null, e.Data.Configuration, mainFileNameTemp, stubFileNameTemp);
             System.Diagnostics.Process.Start("notepad", mainFileNameTemp);
             System.Diagnostics.Process.Start("notepad", stubFileNameTemp);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             e.Cancel = true;
         }
         ////finally
         ////{
         ////    //File.Delete(mainFileNameTemp);
         ////    //File.Delete(stubFileNameTemp);
         ////}
     }
 }
예제 #2
0
        public bool RunWizard()
        {
            this.runCallCount++;
            Assert.AreEqual <int>(1, this.runCallCount, "Run form must only ever be called once");
            Assert.IsNotNull(this.WizardCompleting);
            if (this.runWizardThrowsException)
            {
                throw new UserException("RunWizard exception");
            }

            if (Executable != null)
            {
                dataToReturn = new WizardData();
                dataToReturn.Configuration = new WcfUnitConfiguration();
                UILogic uiLogic = new UILogic();
                using (ScenarioRunManager srm = new ScenarioRunManager())
                {
                    uiLogic.RunProgramAndGetWizardData(Executable, srm, dataToReturn);
                }
            }

            if (resultToReturn)
            {
                CancellableWizardEventArgs cancel = new CancellableWizardEventArgs(dataToReturn, false);
                this.WizardCompleting(this, cancel);
                if (cancel.Cancel)
                {
                    resultToReturn = false;
                }
            }

            return(resultToReturn);
        }