private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (this.WindowState == FormWindowState.Maximized) { settings.windowMaximized = true; } else { settings.windowMaximized = false; if (this.WindowState == FormWindowState.Normal) { // If window is not minimized or maximized, save current size settings.windowWidth = this.Width; settings.windowHeight = this.Height; } } try { settings.save(); } catch (System.IO.IOException /*ioex*/) { // Ignore IO exceptions when saving settings file, to deal with crashes caused by // closing many windows at once. // This isn't a great way to handle the problem, but it's better than getting // the same automated error report over and over. } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (this.WindowState == FormWindowState.Maximized) { settings.windowMaximized = true; } else { settings.windowMaximized = false; if (this.WindowState == FormWindowState.Normal) { // If window is not minimized or maximized, save current size settings.windowWidth = this.Width; settings.windowHeight = this.Height; } } settings.save(); }
private void btnOK_Click(object sender, EventArgs e) { // Save thread thickness setting float threadThickness; if (Single.TryParse(txtThreadThickness.Text, out threadThickness)) { settings.threadThickness = threadThickness; } // Save filter stitches settings settings.filterStiches = chkUglyStitches.Checked; float threshold; if (Single.TryParse(txtThreshold.Text, out threshold)) { settings.filterStitchesThreshold = threshold; } // Save Transparency grid settings settings.transparencyGridEnabled = chkDrawGrid.Checked; settings.transparencyGridSize = gridSize; if (chkDrawGrid.Checked) { settings.transparencyGridColor = transparencyGridColor; } // Save background color settings settings.backgroundColorEnabled = backgroundColorEnabled; if (backgroundColorEnabled) { settings.backgroundColor = pnlBackground.BackColor; } // Save translation setting settings.translation = availableTranslations[cmbLanguage.SelectedIndex].Item2; // Save settings file settings.save(); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { settings.windowWidth = this.Width; settings.windowHeight = this.Height; settings.save(); }