public void SubscribeGenerationRunner(GenerationRunner runner) { if (runner == null) { throw new ArgumentNullException(nameof(runner)); } RunBeforeGenerationStarted.ForEach(e => runner.RunBeforeGenerationStarted += e); RunGenerationStarted.ForEach(e => runner.RunGenerationStarted += e); RunGenerationCompleted.ForEach(e => runner.RunGenerationCompleted += e); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); _process = new GenerationRunner(); _process.ProcessesStopped += (sender, e) => { _reset.Sensitive = true; UpdateControlEnablement(true); if (e.ReasonForStopping == ProcessingStoppedEventArgs.HaltReason.Exception) { Invoke(() => { MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, e.Exception.Message); md.Run(); md.Destroy(); _action.Sensitive = false; _action.Label = "Exception"; _environments.Active = -1; }); } else { Invoke(() => { _generationLabel.Text = _currentEvaluator.Generations.ToString(); _running = false; _action.Label = "Go"; _action.Sensitive = true; }); } }; LoadEnvironments(); _environments.Active = 0; _resetWarning.Visible = false; }