public Options(Form1 inputParent) { parent = inputParent; config = inputParent.getConfig(); InitializeComponent(); textBox1.Text = config.host; textBox2.Text = config.port.ToString(); textBox3.Text = config.login; textBox4.Text = config.password; checkBox1.Checked = config.ssl; checkBox2.Checked = config.onTop; checkBox3.Checked = config.onTaskbar; int refreshTime = config.msRefreshDelay / 1000; numericUpDown1.Value = refreshTime / 60; numericUpDown2.Value = refreshTime % 60; trackBar1.Value = (int)(config.opacity * (double)trackBar1.Maximum); }
public Form1() { InitializeComponent(); Stream stream; if(File.Exists("config.osl")){ stream = File.Open("config.osl", FileMode.Open); BinaryFormatter bformatter = new BinaryFormatter(); config = (Config)bformatter.Deserialize(stream); stream.Close(); } else { optionForm = new Options(this); optionForm.Show(); } //Thread t = new Thread(new ThreadStart(RefreshingThread)); try { using (stream = File.Open("data.bin", FileMode.Open)) { BinaryFormatter bin = new BinaryFormatter(); var uuids = (List<string>)bin.Deserialize(stream); foreach (string uuid in uuids) { readMails.Add(uuid); } } } catch (IOException) { } t.Start(); this.Location = config.startLoc; this.Opacity = config.opacity; this.TopMost = config.onTop; this.ShowInTaskbar = config.onTaskbar; alwaysOnTopToolStripMenuItem.Checked = this.TopMost; }