private void startstopbutton_Click(object sender, EventArgs e) { if (_worker != null) { _worker.CancelAsync(); ResetViewAfterExecution(); } else { var config = ConfigTextConverter.TryTextToObject(configTextBox.Text); if (config == null) { return; } RuntimeVariables.ActiveConfig = config; PrepareViewForExecution(); _worker = new BackgroundWorker(); _worker.DoWork += WorkerOnDoWork; _worker.RunWorkerCompleted += WorkerOnRunWorkerCompleted; _worker.WorkerReportsProgress = true; _worker.ProgressChanged += WorkerOnProgressChanged; _worker.RunWorkerAsync(); } }
private void saveconfigbutton_Click(object sender, EventArgs e) { var config = ConfigTextConverter.TryTextToObject(configTextBox.Text); if (config == null) { return; } RuntimeVariables.ActiveConfig = config; config.ChangeDate = DateTime.Now.ToString("dd. MM. yyyy HH:mm"); config.Author = authortextbox.Text; config.Name = nametextbox.Text; configTextBox.Text = ConfigTextConverter.ObjectToText(config); File.WriteAllText(Path.Combine(FileHelper.GetConfigBasePath(), configSourceComboBox.SelectedItem.ToString()), configTextBox.Text); }