private void TestAllBTN_Click(object sender, EventArgs e) { try { if (m_running) { throw new InvalidOperationException("A test is already running."); } ResultsCTRL.Clear(); OkBTN.Enabled = m_running = true; ThreadPool.QueueUserWorkItem(new WaitCallback(DoAllTests), null); } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); } }
/// <summary> /// Loads previously saved results. /// </summary> private void LoadResults(string filePath) { Stream istrm = File.OpenRead(filePath); DataContractSerializer serializer = new DataContractSerializer(typeof(PerformanceTestResult[])); PerformanceTestResult[] results = (PerformanceTestResult[])serializer.ReadObject(istrm); istrm.Close(); ResultsCTRL.Clear(); foreach (PerformanceTestResult result in results) { ResultsCTRL.Add(result); } m_filePath = filePath; }