From 58787de54ac8dd72f3bf9c824ba440d0f1cf6fe9 Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Mon, 17 Jan 2022 20:51:25 +0000 Subject: [PATCH] Update README.md --- README.md | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 14ecf8fc..cf6257c7 100644 --- a/README.md +++ b/README.md @@ -51,32 +51,33 @@ Windows apps should be as fast and as easy to install and update as apps like Go 3. Handle Squirrel events somewhere very early in your application startup (such as the beginning of `main()` or `Application.OnStartup()` for WPF). ```cs - public static int Main(string[] args) + public static void Main(string[] args) { + // run Squirrel first, as the app may exit after these run SquirrelAwareApp.HandleEvents( - onInitialInstall: OnInstall, - onAppUpdate: OnUpdate, - onAppUninstall: OnUninstall, - onFirstRun: OnFirstRun); - - // ... + onInitialInstall: OnAppInstall, + onAppUninstall: OnAppUninstall, + onEveryRun: OnAppRun); + + // ... other app init code after ... } - private static void OnInstall(Version obj) + private static void OnAppInstall(SemanticVersion version, IAppTools tools) { - using var mgr = new UpdateManager("https://the.place/you-host/updates"); - mgr.CreateUninstallerRegistryEntry(); - mgr.CreateShortcutForThisExe(ShortcutLocation.StartMenu | ShortcutLocation.Desktop); + tools.CreateShortcutForThisExe(ShortcutLocation.StartMenu | ShortcutLocation.Desktop); } - - private static void OnUninstall(Version obj) + + private static void OnAppUninstall(SemanticVersion version, IAppTools tools) { - using var mgr = new UpdateManager("https://the.place/you-host/updates"); - mgr.RemoveUninstallerRegistryEntry(); - mgr.RemoveShortcutForThisExe(ShortcutLocation.StartMenu | ShortcutLocation.Desktop); + tools.RemoveShortcutForThisExe(ShortcutLocation.StartMenu | ShortcutLocation.Desktop); + } + + private static void OnAppRun(SemanticVersion version, IAppTools tools, bool firstRun) + { + tools.SetProcessAppUserModelId(); + // show a welcome message when the app is first installed + if (firstRun) MessageBox.Show("Thanks for installing my application!"); } - - // ... ``` When installed, uninstalled or updated, these methods will be executed, giving your app a chance to add or remove application shortcuts or perform other tasks.