|
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using MessageManager;
namespace Desktop_Web_Stats
{
public partial class Preferences : Form
{
private Properties.Settings settings = Properties.Settings.Default;
private List<string> changePool;
public Preferences()
{
InitializeComponent();
}
private void ok_Btn_Click(object sender, EventArgs e)
{
this.Visible = false;
if (changePool.Contains("True"))
{
settings.updateInterval = (short)updateInterval_UpDn.Value;
settings.autoStart = autoStart_ckBox.Checked;
settings.playDing = playDing_ckBox.Checked;
Main.preferencesChanged = true;
try
{
settings.Save();
Main.preferencesChanged = true;
Dialog.Message("Success", "Your new preferences were saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch
{
Dialog.Message("Error", "An error occurred\nTry again to change your preferences", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
Main.preferencesChanged = false;
Dialog.Message("Cancelled", "No changes were made", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void Preferences_Load(object sender, EventArgs e)
{
changePool = new List<string>() { "False", "False", "False" };
updateInterval_UpDn.Value = settings.updateInterval;
autoStart_ckBox.Checked = settings.autoStart;
playDing_ckBox.Checked = settings.playDing;
}
private void Preferences_FormClosed(object sender, FormClosedEventArgs e)
{
Dispose(true);
}
private void updateInterval_UpDn_Click(object sender, EventArgs e)
{
changePool[0] = (short)updateInterval_UpDn.Value != (short)settings["updateInterval"] ? "True" : "False";
}
private void autoStart_ckBox_Click(object sender, EventArgs e)
{
changePool[1] = autoStart_ckBox.Checked != (bool)settings["autoStart"] ? "True" : "False";
}
private void playDing_ckBox_Click(object sender, EventArgs e)
{
changePool[2] = playDing_ckBox.Checked != (bool)settings["playDing"] ? "True" : "False";
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.