Browse Source

Fixed admin prompt no in restart button

flabbet 4 years ago
parent
commit
67bee949aa
2 changed files with 12 additions and 4 deletions
  1. 2 2
      PixiEditor/Properties/AssemblyInfo.cs
  2. 10 2
      PixiEditor/ViewModels/ViewModelMain.cs

+ 2 - 2
PixiEditor/Properties/AssemblyInfo.cs

@@ -50,5 +50,5 @@ using System.Windows;
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 
-[assembly: AssemblyVersion("0.1.3.0")]
-[assembly: AssemblyFileVersion("0.1.3.0")]
+[assembly: AssemblyVersion("0.1.3.2")]
+[assembly: AssemblyFileVersion("0.1.3.2")]

+ 10 - 2
PixiEditor/ViewModels/ViewModelMain.cs

@@ -330,8 +330,16 @@ namespace PixiEditor.ViewModels
 
         private void RestartApplication(object parameter)
         {
-            ProcessHelper.RunAsAdmin(Path.Join(AppDomain.CurrentDomain.BaseDirectory, "PixiEditor.UpdateInstaller.exe"));
-            Application.Current.Shutdown();
+            try
+            {
+                ProcessHelper.RunAsAdmin(Path.Join(AppDomain.CurrentDomain.BaseDirectory, "PixiEditor.UpdateInstaller.exe"));
+                Application.Current.Shutdown();
+            }
+            catch (Win32Exception)
+            {
+                MessageBox.Show("Couldn't update without administrator rights.", "Insufficient permissions",
+                    MessageBoxButton.OK, MessageBoxImage.Error);
+            }
         }
 
         public async Task<bool> CheckForUpdate()