aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Reed <ebr@mediabrowser3.com>2013-02-28 11:33:54 -0500
committerEric Reed <ebr@mediabrowser3.com>2013-02-28 11:33:54 -0500
commitbbb654c03000adda608c78bcb380369eec35225a (patch)
tree656e92b39462c63e9ef50062c2f834cde6f28156
parent203f2fff127ff618585a7970d150dd46991e3f34 (diff)
Add server shutdown to uninstaller
Shutdown still doesn't work on server end
-rw-r--r--MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs18
1 files changed, 17 insertions, 1 deletions
diff --git a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
index 9937177a7..702c76bf6 100644
--- a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
+++ b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
+using System.Net;
using System.Reflection;
using System.IO;
using System.Threading;
@@ -78,6 +79,21 @@ namespace MediaBrowser.Uninstaller.Execute
if (Product == "Server")
{
RemoveShortcut(Path.Combine(startMenu, "MB Dashboard.lnk"));
+ using (var client = new WebClient())
+ {
+ lblHeading.Content = "Shutting Down Server...";
+ try
+ {
+ client.UploadString("http://localhost:8096/mediabrowser/system/shutdown", "");
+ }
+ catch (WebException ex)
+ {
+ if (ex.Status != WebExceptionStatus.ConnectFailure && !ex.Message.StartsWith("Unable to connect", StringComparison.OrdinalIgnoreCase))
+ {
+ MessageBox.Show("Error shutting down server. Please be sure it is not running before hitting OK.\n\n" + ex.Status + "\n\n" + ex.Message);
+ }
+ }
+ }
}
// if the startmenu item is empty now - delete it too
if (Directory.GetFiles(startMenu).Length == 0)
@@ -99,6 +115,7 @@ namespace MediaBrowser.Uninstaller.Execute
var rootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
+ lblHeading.Content = "Removing System Files...";
if (cbxRemoveAll.IsChecked == true)
{
// Just remove our whole directory
@@ -107,7 +124,6 @@ namespace MediaBrowser.Uninstaller.Execute
else
{
// First remove the system
- lblHeading.Content = "Removing System Files...";
RemovePath(Path.Combine(rootPath, "System"));
RemovePath(Path.Combine(rootPath, "MediaTools"));