diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-23 17:31:57 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-23 17:31:57 -0500 |
| commit | 637319e1ce58af3892a865e17bdd52d95a0ff1c1 (patch) | |
| tree | 6dbe7fa0b926cca289194c711ffd9d2697203abe /MediaBrowser.Uninstaller/MainWindow.xaml.cs | |
| parent | 2e4db7554041ecf481d3a38656fccc309e13eb5b (diff) | |
| parent | b3664edf506d1887f1d0c14db745f644537628e7 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Uninstaller/MainWindow.xaml.cs')
| -rw-r--r-- | MediaBrowser.Uninstaller/MainWindow.xaml.cs | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/MediaBrowser.Uninstaller/MainWindow.xaml.cs b/MediaBrowser.Uninstaller/MainWindow.xaml.cs new file mode 100644 index 000000000..afe9f0e67 --- /dev/null +++ b/MediaBrowser.Uninstaller/MainWindow.xaml.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; + +namespace MediaBrowser.Uninstaller +{ + /// <summary> + /// Interaction logic for MainWindow.xaml + /// </summary> + public partial class MainWindow : Window + { + protected string Product = "Server"; + + public MainWindow() + { + InitializeComponent(); + var args = Environment.GetCommandLineArgs(); + var product = args.Length > 1 ? args[1] : "server"; + + switch (product) + { + case "server": + Product = "Server"; + break; + + case "mbt": + Product = "Theater"; + break; + + default: + Console.WriteLine("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 + + } + } +} |
