From d3e6dd55350293673e8e494b3d7c4bcd6c79768d Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Thu, 28 Feb 2013 12:12:38 -0500 Subject: [PATCH] MBTheater shutdown code in installer/uninstaller --- MediaBrowser.Installer/MainWindow.xaml.cs | 20 +++++++++++++++++++ .../MainWindow.xaml.cs | 16 +++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/MediaBrowser.Installer/MainWindow.xaml.cs b/MediaBrowser.Installer/MainWindow.xaml.cs index f3f3c7740..58d1d11ac 100644 --- a/MediaBrowser.Installer/MainWindow.xaml.cs +++ b/MediaBrowser.Installer/MainWindow.xaml.cs @@ -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); diff --git a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs index 9906af273..28eded0b9 100644 --- a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs +++ b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs @@ -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) {