MBTheater shutdown code in installer/uninstaller

This commit is contained in:
Eric Reed 2013-02-28 12:12:38 -05:00
parent cc574074b9
commit d3e6dd5535
2 changed files with 36 additions and 0 deletions

View file

@ -131,6 +131,26 @@ namespace MediaBrowser.Installer
}
}
}
else
{
if (PackageName == "MBTheater")
{
// Uninstalling MBT - shut it down if it is running
var processes = Process.GetProcessesByName("mediabrowser.ui");
if (processes.Length > 0)
{
try
{
processes[0].CloseMainWindow();
}
catch (Exception ex)
{
MessageBox.Show("Unable to shutdown Media Browser Theater. Please ensure it is not running before hitting OK.\n\n" + ex.Message, "Error");
}
}
}
}
// Download
var archive = await DownloadPackage(version);

View file

@ -98,6 +98,22 @@ namespace MediaBrowser.Uninstaller.Execute
}
}
}
else
{
// Installing MBT - shut it down if it is running
var processes = Process.GetProcessesByName("mediabrowser.ui");
if (processes.Length > 0)
{
try
{
processes[0].CloseMainWindow();
}
catch (Exception ex)
{
MessageBox.Show("Unable to shutdown Media Browser Theater. Please ensure it is not running before hitting OK.\n\n" + ex.Message, "Error");
}
}
}
// if the startmenu item is empty now - delete it too
if (Directory.GetFiles(startMenu).Length == 0)
{