예제 #1
0
        public TestContentForm(TestorData data)
        {
            InitializeComponent();
            _data = data;
            int i = 0;

            foreach (var test in ProjectState.TestHelpers.OrderBy(c => c.TestName))
            {
                if (test.IsMasterTest)
                {
                    continue;
                }
                if (test.IsTestorDataLoaded && test.TestorData == data)
                {
                    _index = i;
                }
                tscbTests.Items.Add(test);
                i++;
            }
            tscbTests.SelectedIndex = _index;
            bool canBackForward = ProjectState.TestHelpers.Count > 1;

            tsbBackTest.Enabled    = canBackForward;
            tsbForwardTest.Enabled = canBackForward;

            _provider = new EditProvider(HtmlStore.GetHtmlStore(_data, 1));
            _provider.ProviderMode = ProviderMode.EditMode;
            TestingHttpServer.StartServer(_provider);
            TestingHttpServer.ServerNotStarted.WaitOne();
            webBrowserQuestion.Navigate(TestingHttpServer.BaseUrl);
        }
예제 #2
0
 public void StopServer()
 {
     TestingHttpServer.StopServer();
     _provider.ScoreChanged   -= new EventHandler <EventArgs>(_provider_ScoreChanged);
     _provider.StateChanged   -= new EventHandler <EventArgs>(_provider_StateChanged);
     _provider.TimeChanged    -= new EventHandler <EventArgs>(_provider_TimeChanged);
     _provider.WarningMessage -= new EventHandler <EventArgs>(_provider_WarningMessage);
     timer.Stop();
 }
예제 #3
0
 private static string ConvertImageUris(string html, int index, ProviderMode mode)
 {
     if (mode == ProviderMode.LocalMode || mode == ProviderMode.EditMode)
     {
         return(html.Replace("#$", TestingHttpServer.GetUrl("images")).Replace("#%", "."));
     }
     else
     {
         return(html.Replace("#$", "/ImageHandler.aspx?id=").Replace("#%", "."));
     }
 }
예제 #4
0
 public AppealForm(TestSessionStatistics currentSession)
 {
     InitializeComponent();
     _currentSession = currentSession;
     this.Text      += String.Format(" - {0} {1} {2}", HtmlStore.GetString(_currentSession.LastName),
                                     HtmlStore.GetString(_currentSession.FirstName), HtmlStore.GetString(_currentSession.SecondName));
     _questions = StaticServerProvider.TestClient.GetSessionQuestions(_currentSession.TestSessionId);
     _provider  = new AppealProvider(_currentSession, _questions, null);
     TestingHttpServer.StartServer(_provider);
     TestingHttpServer.ServerNotStarted.WaitOne();
     webBrowser.Navigate(TestingHttpServer.BaseUrl);
 }
예제 #5
0
 public void StartServer(TestingProvider provider)
 {
     _provider                 = provider;
     _provider.TimeChanged    += new EventHandler <EventArgs>(_provider_TimeChanged);
     _provider.ScoreChanged   += new EventHandler <EventArgs>(_provider_ScoreChanged);
     _provider.StateChanged   += new EventHandler <EventArgs>(_provider_StateChanged);
     _provider.WarningMessage += new EventHandler <EventArgs>(_provider_WarningMessage);
     TestingHttpServer.StartServer(_provider);
     TestingHttpServer.ServerNotStarted.WaitOne();
     lblTestName.Text = String.Format("Тест: \"{0}\"", _provider.TestName);
     _provider_StateChanged(this, new EventArgs());
     webBrowser.Navigate(TestingHttpServer.BaseUrl);
 }
예제 #6
0
 private void btnNext_Click(object sender, EventArgs e)
 {
     if (SystemStateManager.TestState())
     {
         return;
     }
     TestingHttpServer.AllowConnections = true;
     if (_provider.State == ProviderState.PreTesting)
     {
         webBrowser.Navigate(TestingHttpServer.GetUrl("start"));
     }
     else if (_provider.State == ProviderState.Testing)
     {
         webBrowser.Navigate(TestingHttpServer.BaseUrl);
     }
     else if (_provider.State == ProviderState.Results)
     {
         if (this.Parent is Form)
         {
             (this.Parent as Form).Close();
         }
     }
 }
예제 #7
0
 private void AppealForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     TestingHttpServer.StopServer();
 }
예제 #8
0
 private void TestContentForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     TestingHttpServer.StopServer();
 }