aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-02-25 22:43:56 -0500
committerLukePulverenti <luke.pulverenti@gmail.com>2013-02-25 22:43:56 -0500
commitefdb2f3990f6a5250949b7a86bbd83def876f612 (patch)
treed4c7df1c5f159e5a544ebf0b168f18cb302a7712 /MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
parent2d06095447b972c8c7239277428e2c67c8b7ca86 (diff)
parent59ce9444786c4cb3a4eac23f4d26c537a9983c8f (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Conflicts: Nuget/MediaBrowser.ApiClient.nuspec
Diffstat (limited to 'MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs')
-rw-r--r--MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs82
1 files changed, 82 insertions, 0 deletions
diff --git a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
new file mode 100644
index 000000000..bdf34b956
--- /dev/null
+++ b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using System.IO;
+using System.Threading;
+using System.Windows;
+
+namespace MediaBrowser.Uninstaller.Execute
+{
+ /// <summary>
+ /// Interaction logic for MainWindow.xaml
+ /// </summary>
+ public partial class MainWindow : Window
+ {
+ protected string Product = "Server";
+
+ public MainWindow()
+ {
+ Thread.Sleep(800); // be sure our caller is shut down
+
+ var args = Environment.GetCommandLineArgs();
+ var product = args.Length > 1 ? args[1] : "server";
+ InitializeComponent();
+
+
+ switch (product)
+ {
+ case "server":
+ Product = "Server";
+ break;
+
+ case "mbt":
+ Product = "Theater";
+ break;
+
+ default:
+ MessageBox.Show("Please specify which application to un-install (server or mbt)");
+ Close();
+ break;
+
+ }
+
+ lblHeading.Content = this.Title = "Uninstall Media Browser " + Product;
+
+ }
+
+ private void btnCancel_Click(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
+
+ private void cbxRemoveAll_Checked(object sender, RoutedEventArgs e)
+ {
+ if (cbxRemoveAll.IsChecked == true)
+ {
+ cbxRemoveCache.IsChecked = cbxRemoveConfig.IsChecked = cbxRemovePlugins.IsChecked = true;
+ }
+
+ cbxRemoveCache.IsEnabled = cbxRemoveConfig.IsEnabled = cbxRemovePlugins.IsEnabled = !cbxRemoveAll.IsChecked.Value;
+ }
+
+ private void btnUninstall_Click(object sender, RoutedEventArgs e)
+ {
+ // First remove our shortcuts
+ var startMenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Media Browser");
+ var linkName = "Media Browser " + Product + ".lnk";
+ try
+ {
+ File.Delete(Path.Combine(startMenu,linkName));
+ }
+ catch {} // oh well
+
+ linkName = "Uninstall " + linkName;
+ try
+ {
+ File.Delete(Path.Combine(startMenu,linkName));
+ }
+ catch {} // oh well
+
+ }
+ }
+}