Merge pull request #1099 from mattias-symphony/SDA-2526

fix: SDA-2526 Display uninstall confirmation dialog
This commit is contained in:
mattias-symphony 2020-10-20 08:20:33 +02:00 committed by GitHub
commit a8023eef6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,6 +215,7 @@ class Script
.Add<Symphony.ExitDlg>();
project.Load += project_Load;
project.BeforeInstall += project_BeforeInstall;
project.Platform = Platform.x64;
@ -253,6 +254,26 @@ class Script
}
}
// Display a confirmation dialog when uninstalling Symphony, and cancel uninstall unless user confirms.
static void project_BeforeInstall(SetupEventArgs e)
{
try
{
if (e.IsUninstalling)
{
var result = System.Windows.Forms.MessageBox.Show("Are you sure you want to uninstall this product?",
"Windows Installer", System.Windows.Forms.MessageBoxButtons.YesNo);
if (result != System.Windows.Forms.DialogResult.Yes)
{
e.Result = ActionResult.UserExit; // Signal to installer to exit
}
}
}
catch (System.Exception ex)
{
e.Session.Log("Error displaying uninstall confirmation dialog: " + ex.ToString() );
}
}
}
public class CustomActions