void genForm_FormClosed(object sender, FormClosedEventArgs e) { setButtonsState(false); GeneratorForm genForm = (GeneratorForm)sender; Generator eventGenerator = new Generator(); //randomEventList = eventGenerator.generateEvents(genForm.amount); randomEventList = eventGenerator.generateRandomEvents(genForm.amount); BackgroundWorker newWorker = new BackgroundWorker(); newWorker.WorkerSupportsCancellation = false; newWorker.WorkerReportsProgress = false; newWorker.DoWork += bw_DoWork; newWorker.RunWorkerCompleted += bw_RunWorkerCompleted; newWorker.RunWorkerAsync(); }
//TODO remove test function. // TODO put everything on github private void testGenerator() { Generator gen = new Generator(); List<IEvent> gent = gen.generateRandomEvents(1000); int ListChanged = 0; int TodoCreated = 0; int PrioChanged = 0; int PrioDec = 0; int TodoDeleted = 0; int TodosDeleted = 0; int IndexChanged = 0; foreach (IEvent @event in gent) { if (@event.GetType().Equals(typeof(ListNameChanged))) ListChanged++; else if (@event.GetType().Equals(typeof(TodoItemCreated))) TodoCreated++; else if (@event.GetType().Equals(typeof(TodoItemPriorityChanged))) PrioChanged++; else if (@event.GetType().Equals(typeof(TodoItemDeleted))) TodoDeleted++; else if (@event.GetType().Equals(typeof(TodoItemsDeleted))) TodosDeleted++; else if (@event.GetType().Equals(typeof(TodoItemIndexChanged))) IndexChanged++; else if (@event.GetType().Equals(typeof(TodoItemPriorityDecreased))) PrioDec++; } }