using Deckungsbeitrag.Properties; using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.Drawing.Printing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Deckungsbeitrag { public partial class FormEinstellung : Form { private readonly UserSettingsManager _settings = new UserSettingsManager(); string varkosten = ConfigurationManager.AppSettings["Variabel"]; string fixlohnkosten = ConfigurationManager.AppSettings["FixLohn"]; string fixmietkosten = ConfigurationManager.AppSettings["FixMiete"]; public bool changed = false; public bool validating = true; public FormEinstellung() { InitializeComponent(); } public FormEinstellung(object x) : this() { if (x.GetType() == typeof(String)) { if (x.ToString() == "Sortiment") { ButtonPfad_Click(buttonSortiment, null); this.textBoxSortiment.BackColor = Color.Red; } } else { if (x.GetType() == typeof(FormExpedit)) { foreach(Control ctr in this.Controls) { if (ctr.Name.Contains("Drucker") || ctr.Name.Contains("Speichern") || ctr.Name.Contains("Abbrechen")) ctr.Enabled = true; else ctr.Enabled = false; } } } } private void FormEinstellung_Load(object sender, EventArgs e) { // Standard Drucker und Kopieanzahl einstellen. foreach (string printer in PrinterSettings.InstalledPrinters) { this.comboBoxEtikettDrucker.Items.Add(printer); this.comboBoxSWSDrucker.Items.Add(printer); } Load_Settings(); } private void Load_Settings() { _settings.Load(); //TODO: Settings hier ändern auf UserSettingsManager Klasse. this.checkBoxMaxWert.Checked = Settings.Default.MaxChecked; this.checkBoxMinWert.Checked = Settings.Default.MinChecked; this.numUpDownAnzahl.Value = Settings.Default.ZAnzahl; if (checkBoxMaxWert.Checked) { this.numUpDownMaxWert.Value = (int)Settings.Default.RatMax; this.numUpDownMaxWert.Enabled = true; } if (checkBoxMinWert.Checked) { this.numUpDownMinWert.Value = (int)Settings.Default.RatMin; this.numUpDownMinWert.Enabled = true; } this.textBoxSortiment.Text = ConfigurationManager.AppSettings["SortimentPfad"]; this.textBoxRatingbild.Text = ConfigurationManager.AppSettings["BildPfad"]; // Ab hier wurde bereits auf UserSettingsManager umgebaut. this.comboBoxEtikettDrucker.SelectedText = _settings.DruckerEtikett; this.comboBoxSWSDrucker.SelectedText = _settings.DruckerSWS; this.numericUpDownSWSKopien.Value = _settings.CopiesSWS; foreach (Button btn in this.groupBoxFarben.Controls.OfType