private void loadScenarioButton_Click(object sender, EventArgs e) { new SQLDeleter(); HcScen_1 testScen = new HcScen_1(); ScenarioAnalyser analyser = new ScenarioAnalyser(testScen); Persistence occConnectedPers = new Persistence(); testScen.playEvents(this.persistence, occConnectedPers); //BackgroundWorker newWorker = new BackgroundWorker(); //newWorker.WorkerSupportsCancellation = false; //newWorker.WorkerReportsProgress = true; //newWorker.DoWork += getAllScenarioTestResults; //newWorker.ProgressChanged += updateScenarioTestResults; //newWorker.RunWorkerAsync(); }
private void getAllScenarioTestResults(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; List<String> results = new List<String>(); for (int i = 1; i < 10; i++) { new SQLDeleter(); Persistence offLinePersistence = new Persistence(); this.persistence = new Persistence(); //string loc = "C:\\TEMP\\set1.txt"; string loc = "C:\\TEMP\\RScen" + i + ".txt"; RandomScenarioGenerator randGen = new RandomScenarioGenerator(); // Scenario generatedScenario = randGen.generateRandomScenario(2000); //randGen.ObjectToFile(generatedScenario, loc); Scenario temp = (Scenario)randGen.FileToObject(loc); //generatedScenario.playEvents(this.persistence, tempPersistence); ScenarioAnalyser analyser = new ScenarioAnalyser(loc); //Scenario temp = new CustomScenario(); //CustomOBScenario obScen = new CustomOBScenario(); temp.playEvents(this.persistence, offLinePersistence); results.Add("Testset: " + i +"\n" + "Commited : " + this.persistence.getLatestStreamRevision() + " \n" + "BaseConflicts : " + analyser.baseConflictAmount + " \n" + "FOund conflicts " + offLinePersistence.allConflicts.Count + " \n" + "Percentage solved" + (1 - (float)offLinePersistence.allConflicts.Count / (float)analyser.baseConflictAmount) + " \n" + "" + "" + " \n"); worker.ReportProgress(0, results[i-1]); } }