private void ChangeLabel(Label lbl, bool success) { if (success) { lbl.Text = "Erfolgreich"; lbl.ForeColor = Color.Green; } else { lbl.Text = "Fehler"; lbl.ForeColor = Color.Red; } ShowControlXSeconds.ShowLabel(lbl, 2); }
private void cmdSave_Click(object sender, EventArgs e) { try { Properties.Settings.Default.Kandidaten = rtbKandidaten.Text; Properties.Settings.Default.AnzahlStimmzettelbisBackup = Convert.ToInt32(nudBackup.Value); Properties.Settings.Default.MaximaleAuswahl = Convert.ToInt32(nudMaxStimmen.Value); Properties.Settings.Default.X_Checkbox = Convert.ToInt32(nudXPosition.Value); Properties.Settings.Default.Y_Checkbox = Convert.ToInt32(nudYPosition.Value); Properties.Settings.Default.WindowWidth = Convert.ToInt32(nudWindowWidth.Value); Properties.Settings.Default.WindowHeight = Convert.ToInt32(nudWindowHeight.Value); Properties.Settings.Default.Save(); this.Close(); } catch (Exception ex) { ShowControlXSeconds.ShowLabel(lblError, 4); } }