Merge branch 'autostart-standalone' into develop

pull/9/head^2
sleevezipper 4 years ago
commit 65edc8160e

@ -21,14 +21,16 @@ It will try to futher accomplish this goal in the future by:
## Installation
You can get the installer from [here](https://hassworkstationstorage.z6.web.core.windows.net/publish/setup.exe). When using the installer, the application checks for updates on startup.
You can get the installer from [here](https://hassworkstationstorage.z6.web.core.windows.net/publish/setup.exe). When using the installer, the application checks for updates on startup. This is the recommended way to install for most users.
Note: You'll get a Windows Smartscreen warning because the code was self signed. You can click "More info" and then "Run anyway" to proceed with installing.
If you don't want to use the installer, you can find releases on GitHub [here](https://github.com/sleevezipper/hass-workstation-service/releases). `hass-workstation-service.exe` is the background service and you can use `UserInterface.exe` to configure the service. If you don't use the installer autostart won't work.
### Standalone
If you don't want to use the installer, you can find the standalone version releases on GitHub [here](https://github.com/sleevezipper/hass-workstation-service/releases). Unpack all files to a folder and run `hass-workstation-service.exe`. This is the background service and you can use `UserInterface.exe` to configure the service. There is no automatic (or prompted) updating in the standalone version.
### Updating
The app checks for updates on startup. If an update is available you will be prompted to install.
If you used the installer, the app checks for updates on startup. If an update is available you will be prompted to install. If you use the standalone, just delete all files from the previous install and unpack the zip to the same location as before.
## Sensors

@ -273,8 +273,19 @@ namespace hass_workstation_service.Data
// The path to the key where Windows looks for startup applications
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
//Path to launch shortcut
string startPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs) + @"\Sleevezipper\Hass Workstation Service.appref-ms";
string startPath;
// if the app is installed in appdata, we can assume it was installed using the installer
if (Environment.CurrentDirectory.Contains(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)))
{
// so we set the autostart Path to launch shortcut
startPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs) + @"\Sleevezipper\Hass Workstation Service.appref-ms";
}
else
{
// if it isn't in appdata, it's probably running as standalone and we set the startpath to the path of the executable
startPath = Environment.CurrentDirectory + @"\hass-workstation-service.exe";
}
rkApp.SetValue("hass-workstation-service", startPath);
rkApp.Close();

Loading…
Cancel
Save