If personal path is modified in application settings window then show message box to tell users that ShareX must be reopened for changes to take effect

This commit is contained in:
Jaex 2016-09-30 13:07:48 +03:00
parent 5e79bd7b2a
commit 6087ea40fb

View file

@ -38,6 +38,7 @@ public partial class ApplicationSettingsForm : Form
private const int MaxBufferSizePower = 14;
private bool ready;
private string lastPersonalPath;
public ApplicationSettingsForm()
{
@ -57,7 +58,14 @@ private void SettingsForm_Resize(object sender, EventArgs e)
private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e)
{
Program.WritePersonalPathConfig(txtPersonalFolderPath.Text);
string currentPersonalPath = txtPersonalFolderPath.Text;
if (!currentPersonalPath.Equals(lastPersonalPath, StringComparison.InvariantCultureIgnoreCase))
{
Program.WritePersonalPathConfig(currentPersonalPath);
MessageBox.Show("You must reopen ShareX for personal folder changes to take effect.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void InitializeControls()
@ -123,7 +131,8 @@ private void UpdateControls()
#endif
// Paths
txtPersonalFolderPath.Text = Program.ReadPersonalPathConfig();
lastPersonalPath = Program.ReadPersonalPathConfig();
txtPersonalFolderPath.Text = lastPersonalPath;
UpdatePersonalFolderPathPreview();
cbUseCustomScreenshotsPath.Checked = Program.Settings.UseCustomScreenshotsPath;
txtCustomScreenshotsPath.Text = Program.Settings.CustomScreenshotsPath;