private void SaveRestartAppButton_Click(object sender, EventArgs e) { settings.TrackGameTime = GameTimeCheckbox.Checked; settings.DisableUpdateTimer = DisableUpdateTimerCBox.Checked; if (settings.HasChanged) { DatabaseFile.Write(settings, PathInfos.SettingsPath); Application.Restart(); } else { Close(); } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (LaunchParametersTB.Text != settings.CommandLine) { settings.CommandLine = LaunchParametersTB.Text; } if (settings.HasChanged) { Log.WriteLine(nameof(settings.HasChanged) + ", so writing to disk"); DatabaseFile.Write(settings, PathInfos.SettingsPath); Log.WriteLine("Wrote settings to disk"); } }
private void Hotkeys_Load(object sender, EventArgs e) { oldSettings = new Settings(); oldSettings = settings; DatabaseFile.Write(settings, PathInfos.SettingsPath); //save current settings settings.HasChanged = false; //force it to not be changed so exit without saving works 'properly' //transparent label backcolor var pos = PointToScreen(label2.Location); pos = pictureBox1.PointToClient(pos); label2.Parent = pictureBox1; label2.Location = pos; label2.BackColor = System.Drawing.Color.Transparent; }
static Settings() { string applicationDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\CoDUO FoV Changer"; settingsFile = applicationDataDirectory + @"\settings.xml"; if (!Directory.Exists(applicationDataDirectory)) { Directory.CreateDirectory(applicationDataDirectory); } if (File.Exists(settingsFile)) { instance = DatabaseFile.Read <Settings>(settingsFile); } else { instance = new Settings(); DatabaseFile.Write(instance, settingsFile); } }
private void button2_Click(object sender, EventArgs e) { DatabaseFile.Write(settings, PathInfos.SettingsPath); Close(); }