Permalink
Browse files

Added reset button to application preferences dialog. Button is only …

…active when contents of dialog doesn't match the defaults.
  • Loading branch information...
wyldphyre committed Jan 11, 2007
1 parent f5ff2d2 commit 33525d6c04597a5fd8d7041067006991a059ac06
Showing with 55 additions and 1 deletion.
  1. +1 −0 Changelog.txt
  2. +8 −0 src/Preferences.cs
  3. +15 −0 src/PreferencesDialog.Designer.cs
  4. +31 −1 src/PreferencesDialog.cs
View
@@ -1,3 +1,4 @@
+- Added reset button to applications preferences dialog. (Craig Reynolds)
- Add feedback dialog.
- Refactor 80% of strings to resources.
- Prototype uninstall functionality.
View
@@ -76,6 +76,14 @@ public static Configuration AppConfigSettings
get { return appConfigSettings; }
}
+ /// <summary>
+ /// The loaded application default settings
+ /// </summary>
+ public static Dictionary<string, string> Defaults
+ {
+ get { return defaults; }
+ }
+
/// <summary>
/// Preferred location to search for alternate downloads.
/// </summary>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -17,13 +17,17 @@
using System.Text;
using System.Windows.Forms;
+using InstallPad.Properties;
+
namespace InstallPad
{
public partial class PreferencesDialog : Form
{
// Could bind the controls to a preference value... meh.
// http://msdn2.microsoft.com/en-us/library/system.windows.forms.binding.aspx
+ private Dictionary<string, string> defaults = null;
+
public PreferencesDialog()
{
InitializeComponent();
@@ -44,7 +48,9 @@ private void SavePreferences()
private void PreferencesDialog_Load(object sender, EventArgs e)
{
-
+ //populate defaults to avoid regenerating them each time they are referenced.
+ defaults = InstallPadApp.Preferences.Defaults;
+
this.downloadTo.Text = InstallPadApp.Preferences.DownloadTo;
this.extractTo.Text = InstallPadApp.Preferences.InstallationRoot;
}
@@ -74,5 +80,29 @@ private void okButton_Click(object sender, EventArgs e)
this.DialogResult = DialogResult.OK;
this.Close();
}
+
+ private void resetButton_Click(object sender, EventArgs e)
+ {
+ extractTo.Text = InstallPadApp.Preferences.Defaults[Resources.InstallationRoot];
+ downloadTo.Text = InstallPadApp.Preferences.Defaults[Resources.DownloadTo];
+ }
+
+ public override void Refresh()
+ {
+ base.Refresh();
+
+ resetButton.Enabled = (extractTo.Text != defaults[Resources.InstallationRoot]) ||
+ (downloadTo.Text != defaults[Resources.DownloadTo]);
+ }
+
+ private void extractTo_TextChanged(object sender, EventArgs e)
+ {
+ Refresh();
+ }
+
+ private void downloadTo_TextChanged(object sender, EventArgs e)
+ {
+ Refresh();
+ }
}
}

0 comments on commit 33525d6

Please sign in to comment.