SymphonyElectron/installer/win/WixSharpInstaller/CloseDlg.cs
mattias-symphony 138ded7a74
feat: SDA-2395 Upgrading existing Symphony (#1079)
* SDA-2395 Setting product id and upgrade code

* Added 'Close Symphony' dialog and code to shut down Symphony process

* Fixed whitespace issues

* Update installer/win/WixSharpInstaller/Symphony.cs

Co-authored-by: Vishwas Shashidhar <VishwasShashidhar@users.noreply.github.com>
2020-09-22 21:31:56 +05:30

57 lines
1.6 KiB
C#

using WixSharp;
using System.Drawing;
namespace Symphony
{
public partial class CloseDlg : WixSharp.UI.Forms.ManagedForm, IManagedDialog
{
public CloseDlg()
{
InitializeComponent();
}
void dialog_Load(object sender, System.EventArgs e)
{
// Detect if Symphony is running
bool isRunning = System.Diagnostics.Process.GetProcessesByName("Symphony").Length > 0;
if (isRunning)
{
// If it is running, disable the "next" button
this.next.Enabled = false;
}
else
{
// If it is not running, skip this dialog
Shell.GoNext();
}
// Populate the dynamic UI elements that can't be set at compile time (background image and
// the enabled/disabled state of the `Close Symphony` button)
this.backgroundPanel.BackgroundImage = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Dialog");
}
void closeButton_Click(object sender, System.EventArgs e)
{
// The "Close Symphony" button is just to get users consent to close the app.
// Actually closing the app will be done later in the flow.
Shell.GoNext();
}
void back_Click(object sender, System.EventArgs e)
{
Shell.GoPrev();
}
void next_Click(object sender, System.EventArgs e)
{
Shell.GoNext();
}
void cancel_Click(object sender, System.EventArgs e)
{
Shell.Cancel();
}
}
}