Skip to content

Commit e4bfc14

Browse files
committed
Moved reset button from GeneralSettingsControl onto SettingsDialog's bottom panel
1 parent 769e580 commit e4bfc14

File tree

5 files changed

+42
-65
lines changed

5 files changed

+42
-65
lines changed

RetailCoder.VBE/UI/Settings/GeneralSettingsControl.Designer.cs

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/UI/Settings/GeneralSettingsControl.cs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
using System.IO;
3-
using System.Windows.Forms;
1+
using System.Windows.Forms;
42
using Rubberduck.Settings;
53

64
namespace Rubberduck.UI.Settings
@@ -15,29 +13,8 @@ public GeneralSettingsControl()
1513
InitializeComponent();
1614
TitleLabel.Text = RubberduckUI.SettingsCaption_GeneralSettings;
1715
LanguageLabel.Text = RubberduckUI.Settings_LanguageLabel;
18-
resetSettings.Text = RubberduckUI.Settings_ResetSettings;
1916

2017
LoadLanguageList();
21-
22-
resetSettings.Click += ResetSettingsClick;
23-
}
24-
25-
private void ResetSettingsClick(object sender, EventArgs e)
26-
{
27-
var confirmReset = MessageBox.Show(RubberduckUI.Settings_ResetSettingsConfirmation, RubberduckUI.Settings_Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
28-
if (confirmReset == DialogResult.No)
29-
{
30-
return;
31-
}
32-
33-
ResetSettings();
34-
}
35-
36-
private void ResetSettings()
37-
{
38-
File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Rubberduck\\rubberduck.config"));
39-
var config = _configService.GetDefaultConfiguration();
40-
_configService.SaveConfiguration(config, !Equals(_currentLanguage, config.UserSettings.LanguageSetting));
4118
}
4219

4320
public GeneralSettingsControl(DisplayLanguageSetting displayLanguage, IGeneralConfigService configService)

RetailCoder.VBE/UI/Settings/SettingsDialog.Designer.cs

Lines changed: 17 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/UI/Settings/SettingsDialog.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,37 @@ public _SettingsDialog()
3636

3737
OkButton.Click += OkButton_Click;
3838
CancelButton.Click += CancelButton_Click;
39+
ResetButton.Click += ResetButton_Click;
3940

4041
InitWindow();
4142
}
4243

44+
private void ResetButton_Click(object sender, EventArgs e)
45+
{
46+
var confirmReset = MessageBox.Show(RubberduckUI.Settings_ResetSettingsConfirmation, RubberduckUI.Settings_Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
47+
if (confirmReset == DialogResult.No)
48+
{
49+
return;
50+
}
51+
52+
ResetSettings();
53+
}
54+
55+
private void ResetSettings()
56+
{
57+
var currentLanguage = _config.UserSettings.LanguageSetting;
58+
59+
System.IO.File.Delete(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Rubberduck\\rubberduck.config"));
60+
var config = _configService.GetDefaultConfiguration();
61+
_configService.SaveConfiguration(config, !currentLanguage.Equals(config.UserSettings.LanguageSetting));
62+
}
63+
4364
private void InitWindow()
4465
{
4566
this.Text = RubberduckUI.Settings_Caption;
67+
OkButton.Text = RubberduckUI.OK;
68+
CancelButton.Text = RubberduckUI.CancelButtonText;
69+
ResetButton.Text = RubberduckUI.Settings_ResetSettings;
4670
InstructionsLabel.Text = RubberduckUI.SettingsInstructions_GeneralSettings;
4771
TitleLabel.Text = RubberduckUI.SettingsCaption_GeneralSettings;
4872
}

RetailCoder.VBE/UI/Settings/SettingsDialog.resx

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -117,26 +117,4 @@
117117
<resheader name="writer">
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120-
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
121-
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
122-
<value>
123-
AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA
124-
AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA
125-
AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA
126-
AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw
127-
MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/
128-
//8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/
129-
//8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/
130-
//8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/
131-
//8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1
132-
df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA
133-
AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA
134-
AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA
135-
AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA
136-
AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA
137-
AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA
138-
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH
139-
AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA
140-
</value>
141-
</data>
142120
</root>

0 commit comments

Comments
 (0)