1.1 --- a/Server/StartupManager.cs Sun Jan 18 12:35:22 2015 +0100
1.2 +++ b/Server/StartupManager.cs Sun Jan 18 14:18:28 2015 +0100
1.3 @@ -16,6 +16,7 @@
1.4 using System.Security;
1.5 using System.Security.Principal;
1.6 using System.Windows.Forms;
1.7 +using System.Deployment.Application;
1.8
1.9 namespace SharpDisplayManager
1.10 {
1.11 @@ -115,7 +116,7 @@
1.12 {
1.13 string value = (string)key.GetValue("SharpDisplayManager");
1.14 if (value != null)
1.15 - startup = value == Application.ExecutablePath;
1.16 + startup = value == LaunchCommand;
1.17 }
1.18 }
1.19 isAvailable = true;
1.20 @@ -182,10 +183,23 @@
1.21 catch (IOException) { }
1.22 }
1.23
1.24 + string LaunchCommand
1.25 + {
1.26 + get
1.27 + {
1.28 + //Executable path won't launch ClickOnce Application with deployment enabled.
1.29 + //return Application.ExecutablePath;
1.30 + //Instead we need to launch the application using the .appref-ms shortcut.
1.31 + //That shortcut is located at <programs>\<publisher>\<suite>\<product>.appref-ms
1.32 + return string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "\\", "Slions", "\\", "Sharp Display Manager" , "\\" ,"Sharp Display Manager", ".appref-ms");
1.33 + }
1.34 + }
1.35 +
1.36 private void CreateRegistryRun()
1.37 {
1.38 RegistryKey key = Registry.CurrentUser.CreateSubKey(REGISTRY_RUN);
1.39 - key.SetValue("SharpDisplayManager", Application.ExecutablePath);
1.40 + //Rather than the executable name we pass in the ClickOnce shortcut to make sure we launch with deployment support
1.41 + key.SetValue("SharpDisplayManager", LaunchCommand);
1.42 }
1.43
1.44 private void DeleteRegistryRun()