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); }
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(); }
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("#%", ".")); } }
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); }
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); }
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(); } } }
private void AppealForm_FormClosed(object sender, FormClosedEventArgs e) { TestingHttpServer.StopServer(); }
private void TestContentForm_FormClosing(object sender, FormClosingEventArgs e) { TestingHttpServer.StopServer(); }