Skip to content

Commit 1a402dc

Browse files
Message box pops up after pressing the cancel button or closing the form: "Cancel: changes made in the 'Manually Installed' tab will not be saved, are you sure?". Saving will only be done when pressing the Ok button.
1 parent 9aedc7c commit 1a402dc

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Source/Menu/ContentForm.Designer.cs

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

Source/Menu/ContentForm.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,6 +1598,17 @@ private static bool isWrongPath(string path, GettextResourceManager catalog)
15981598
return false;
15991599
}
16001600

1601+
private void buttonCancel_Click(object sender, EventArgs e)
1602+
{
1603+
string message = Catalog.GetString("Cancel: changes made in the 'Manually Installed' tab will not be saved, are you sure?");
1604+
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
1605+
{
1606+
// not sure, cancel the cancel
1607+
ManualInstallChangesMade = false;
1608+
this.DialogResult = DialogResult.None;
1609+
}
1610+
}
1611+
16011612
private void buttonOK_Click(object sender, EventArgs e)
16021613
{
16031614
// save "Manually Installed" tab changes into the registry/ini file via Settings.Folders.Folders
@@ -1651,6 +1662,8 @@ private void buttonOK_Click(object sender, EventArgs e)
16511662

16521663
Settings.Save();
16531664

1665+
ManualInstallChangesMade = false;
1666+
16541667
this.Close();
16551668
}
16561669

@@ -1682,6 +1695,17 @@ private int findIndexDgvManualInstall(string route)
16821695

16831696
private void DownloadContentForm_FormClosing(object sender, FormClosingEventArgs formClosingEventArgs)
16841697
{
1698+
if (ManualInstallChangesMade)
1699+
{
1700+
string message = Catalog.GetString("Cancel: changes made in the 'Manually Installed' tab will not be saved, are you sure?");
1701+
if (MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
1702+
{
1703+
// not sure, cancel the cancel
1704+
formClosingEventArgs.Cancel = true;
1705+
return;
1706+
}
1707+
}
1708+
16851709
if (AutoInstallClosingBlocked)
16861710
{
16871711
// cancelled event, so continue

0 commit comments

Comments
 (0)