private void load() { Config_.Load(); RefreshPrinters(); counter = Properties.Settings.Default.counter; port_txt.Text = Properties.Settings.Default.Port.ToString(); // port_txt.Text= Properties.Settings.Default.port.ToString(); }
private void save() { Config_.Save(); RefreshPrinters(); Properties.Settings.Default.Port = int.Parse(port_txt.Text); Properties.Settings.Default.counter = counter; // Properties.Settings.Default.port = int.Parse(port_txt.Text); Properties.Settings.Default.Save(); }
public static void Save() { if (ReferenceEquals(Instance, null)) { Instance = new Config_(); } try { BinaryFormatter formatter = new BinaryFormatter(); using (FileStream stream = File.Create(ConfigPath)) { formatter.Serialize(stream, Instance); stream.Flush(); } } catch { } }
public static Config_ Load() { if (File.Exists(ConfigPath)) { try { BinaryFormatter formatter = new BinaryFormatter(); using (FileStream stream = new FileStream(ConfigPath, FileMode.Open)) { Instance = (Config_)formatter.Deserialize(stream); } } catch { Instance = new Config_(); } } else { Instance = new Config_(); return(Instance); } return(Instance); }