clowd / Clowd.Squirrel

Quick and easy installer and automatic updates for cross-platform dotnet applications
427 stars 39 forks source link

Question about update progress / splash screen #169

Closed cupper1 closed 1 year ago

cupper1 commented 1 year ago

Hello, When using this package, as the install runs it shows a nice splash screen with progress bar, works great. When I do the following code to do an update, it just sits forever. I am sure there is a way to show the same splash screen or even just get proactive feedback on how far along the update is?

` addresult($"Agent Checking"); var updateInfo = await mgr.CheckForUpdate();

                if (updateInfo.ReleasesToApply.Any())
                {
                    addresult($"Releases Found");
                    var versionCount = updateInfo.ReleasesToApply.Count;

                    var versionWord = versionCount > 1 ? "versions" : "version";
                    var message = new StringBuilder().AppendLine($"App is {versionCount} {versionWord} behind.").ToString();

                    addresult($"{message}");
                    addresult($"Applying Update");

                    var updateResult = await mgr.UpdateApp();
                    addresult($"Download complete. Version {updateResult.Version} will take effect when App is restarted.");
                    //now suggest a restart
                    MessageBox.Show($"Download complete. Version {updateResult.Version} will take effect when App is restarted. Please restart now.", "App Update", MessageBoxButtons.OK);
                }
                else
                {
                    addresult($"No Update at: {Globals.UserPreferences.updateurl}");
                }`

Can someone show me a basic example of giving feedback? I think I can do something with the "await mgr.updateapp();" line to do a callback to update a screen?

Thanks!!

KennyTK commented 1 year ago

The classes for splash screen have the internal modifier. You could make these accessible in a fork or it could be evaluated if exposing these is within scope.

ComposedWindow.cs

User32SplashWindow.cs

caesay commented 1 year ago

You can implement your own splash/progress UI. UpdateApp already has a callback parameter which will provide you with progress updates (eg. mgr.UpdateApp((progress) => /* update your splash screen */);). You can also look at the source code for UpdateApp if you'd like even more control about how updates are done (Eg. if you want to check for updates but then download them later) https://github.com/clowd/Clowd.Squirrel/blob/develop/src/Squirrel/UpdateManager.cs#L98