diff options
Diffstat (limited to 'MediaBrowser.Uninstaller')
| -rw-r--r-- | MediaBrowser.Uninstaller/MainWindow.xaml | 12 | ||||
| -rw-r--r-- | MediaBrowser.Uninstaller/MainWindow.xaml.cs | 81 | ||||
| -rw-r--r-- | MediaBrowser.Uninstaller/MediaBrowser.Uninstaller.csproj | 8 | ||||
| -rw-r--r-- | MediaBrowser.Uninstaller/Properties/AssemblyInfo.cs | 4 |
4 files changed, 29 insertions, 76 deletions
diff --git a/MediaBrowser.Uninstaller/MainWindow.xaml b/MediaBrowser.Uninstaller/MainWindow.xaml index 54d8f961aa..645996503a 100644 --- a/MediaBrowser.Uninstaller/MainWindow.xaml +++ b/MediaBrowser.Uninstaller/MainWindow.xaml @@ -1,16 +1,8 @@ <Window x:Class="MediaBrowser.Uninstaller.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - Title="Uninstall Media Browser" Height="412.686" Width="633.955"> + Title="MainWindow" Height="350" Width="525"> <Grid> - <Image x:Name="imgLogo" HorizontalAlignment="Center" Height="154" Margin="35,15,35,0" VerticalAlignment="Top" Width="541" Source="/MediaBrowser.Uninstaller;component/Code/Images/mb3logo800.png" Opacity="0.5"/> - <Label x:Name="lblHeading" Content="Uninstall " HorizontalAlignment="Left" Margin="51,169,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.478,-2.753" Height="29" Width="423" FontSize="14" FontWeight="Bold"/> - <Button x:Name="btnUninstall" Content="Uninstall" HorizontalAlignment="Left" Margin="505,341,0,0" VerticalAlignment="Top" Width="75" IsDefault="True" RenderTransformOrigin="0.991,-1.041" Click="btnUninstall_Click"/> - <Button x:Name="btnCancel" Content="Cancel" HorizontalAlignment="Left" Margin="412,341,0,0" VerticalAlignment="Top" Width="75" IsCancel="True" Click="btnCancel_Click"/> - <CheckBox x:Name="cbxRemoveAll" Content="Remove All Traces" HorizontalAlignment="Left" Margin="137,234,0,0" VerticalAlignment="Top" Checked="cbxRemoveAll_Checked" Unchecked="cbxRemoveAll_Checked"/> - <CheckBox x:Name="cbxRemoveCache" Content="Delete Cache Files" HorizontalAlignment="Left" Margin="152,255,0,0" VerticalAlignment="Top"/> - <CheckBox x:Name="cbxRemoveConfig" Content="Delete Configuration and Log Files" HorizontalAlignment="Left" Margin="152,276,0,0" VerticalAlignment="Top"/> - <CheckBox x:Name="cbxRemovePlugins" Content="Delete Plug-ins" HorizontalAlignment="Left" Margin="152,297,0,0" VerticalAlignment="Top"/> - + </Grid> </Window> diff --git a/MediaBrowser.Uninstaller/MainWindow.xaml.cs b/MediaBrowser.Uninstaller/MainWindow.xaml.cs index afe9f0e67b..fb5f32a7f1 100644 --- a/MediaBrowser.Uninstaller/MainWindow.xaml.cs +++ b/MediaBrowser.Uninstaller/MainWindow.xaml.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.IO; using System.Linq; +using System.Reflection; using System.Text; -using System.IO; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -12,6 +15,8 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; +using System.Windows.Shapes; +using Path = System.IO.Path; namespace MediaBrowser.Uninstaller { @@ -20,68 +25,30 @@ namespace MediaBrowser.Uninstaller /// </summary> public partial class MainWindow : Window { - protected string Product = "Server"; - public MainWindow() { - InitializeComponent(); + //All our work is behind the scenes var args = Environment.GetCommandLineArgs(); var product = args.Length > 1 ? args[1] : "server"; - - switch (product) + //copy the real program to a temp location so we can delete everything here (including us) + var tempExe = Path.Combine(Path.GetTempPath(), "MediaBrowser.Uninstaller.Execute.exe"); + var tempConfig = Path.Combine(Path.GetTempPath(), "MediaBrowser.Uninstaller.Execute.exe.config"); + using (var file = File.Create(tempExe, 4096, FileOptions.DeleteOnClose)) { - 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; - + //copy the real uninstaller to temp location + var sourceDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase) ?? ""; + File.WriteAllBytes(tempExe, File.ReadAllBytes(Path.Combine(sourceDir ,"MediaBrowser.Uninstaller.Execute.exe"))); + File.Copy(tempConfig, Path.Combine(sourceDir ,"MediaBrowser.Uninstaller.Execute.exe.config")); + //kick off the copy + MessageBox.Show("About to start " + tempExe); + Process.Start(tempExe, product); + //wait for it to start up + Thread.Sleep(500); + //and shut down + Close(); } - - 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 - + + //InitializeComponent(); } } } diff --git a/MediaBrowser.Uninstaller/MediaBrowser.Uninstaller.csproj b/MediaBrowser.Uninstaller/MediaBrowser.Uninstaller.csproj index a9db3ee9b0..c9c3e537cd 100644 --- a/MediaBrowser.Uninstaller/MediaBrowser.Uninstaller.csproj +++ b/MediaBrowser.Uninstaller/MediaBrowser.Uninstaller.csproj @@ -4,7 +4,7 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{FACAF749-3E28-46DD-B613-654FCD434959}</ProjectGuid> + <ProjectGuid>{21EC6FB8-F444-4B60-8BA5-9CA443901A0D}</ProjectGuid> <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>MediaBrowser.Uninstaller</RootNamespace> @@ -93,12 +93,6 @@ <ItemGroup> <None Include="App.config" /> </ItemGroup> - <ItemGroup /> - <ItemGroup> - <Resource Include="..\MediaBrowser.Installer\Code\Images\mb3logo800.png"> - <Link>Code\Images\mb3logo800.png</Link> - </Resource> - </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/MediaBrowser.Uninstaller/Properties/AssemblyInfo.cs b/MediaBrowser.Uninstaller/Properties/AssemblyInfo.cs index 02bd2c2440..c4a6586ee8 100644 --- a/MediaBrowser.Uninstaller/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Uninstaller/Properties/AssemblyInfo.cs @@ -10,9 +10,9 @@ using System.Windows; [assembly: AssemblyTitle("MediaBrowser.Uninstaller")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Toshiba")] +[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("MediaBrowser.Uninstaller")] -[assembly: AssemblyCopyright("Copyright © Toshiba 2013")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] |
