C
C#11mo ago
Mekasu0124

✅ ✅ Creating a popup on MainWindow

https://github.com/mekasu0124/Todo This is the repo for my todo app. I'm wanting to figure out how to create a popup window that will do the following each time the application is loaded. 1. Check the current version of the app that user has against the latest version of the github repo - If the versions match, continue normal usage - If the versions do not match, then the popup will overshadow the home screen. I'd like for the popup to be the main focus and like blur out the background (home screen) 2. In the popup, it says something like - $"Update {Version} Is Now Ready. Click "Update" Below To Begin The Update" - The user has the option of clicking Update or Cancel. - Cancel will close the entire application - Update will grab the files that it needs to do the update from the repo and being the installation process 3. Installation process - When the application begins to update, I would like for the application to close, and a loading screen show up. This loading screen will have a progress bar and show the progress of the update, and show how much time is remaining until the update is complete. 4. Once the update is complete, I'd like for the loading screen to close, and the application to relaunch itself to open back up. I've never done loading screens, popups, nor anything else relative to this thought process and what's needed to accomplish it and I'm still new to both C# and Avalonia so it'll be a learning process for me, but I figured if I could learn it with this simple application, then I can apply that learning to other applications I build in the future. Thanks in advance.
10 Replies
Denis
Denis11mo ago
Check out model dialogs for Avalonia There should be a nuget package for that Just search github or nuget
Mekasu0124
Mekasu012411mo ago
https://github.com/AvaloniaCommunity/MessageBox.Avalonia I found this avalonia package called messagebox
Mekasu0124
Mekasu012411mo ago
this one seems to be more what I'm looking for as I can set the information like
var messageBoxStandardWindow = MessageBox.Avalonia.MessageBoxManager.GetMessageBoxStandardWindow(
new MessageBoxStandardParams
{
ButtonDefinitions = MessageBoxAvaloniaEnums.ButtonEnum.YesNoCancel,
ContentTitle = "Todo App Updater",
ContentHeader = $"A New Version {Version} Has Been Released.",
ContentMessage = $"You can view the changelog at {SomeUrlHere}",
WindowIcon = new WindowIcon("app_icon.ico")
});
var messageBoxStandardWindow = MessageBox.Avalonia.MessageBoxManager.GetMessageBoxStandardWindow(
new MessageBoxStandardParams
{
ButtonDefinitions = MessageBoxAvaloniaEnums.ButtonEnum.YesNoCancel,
ContentTitle = "Todo App Updater",
ContentHeader = $"A New Version {Version} Has Been Released.",
ContentMessage = $"You can view the changelog at {SomeUrlHere}",
WindowIcon = new WindowIcon("app_icon.ico")
});
Mekasu0124
Mekasu012411mo ago
var msBoxStandardWindow = MessageBox.Avalonia.MessageBoxManager
.GetMessageBoxStandardWindow(new MessageBoxStandardParams{
ButtonDefinitions = ButtonEnum.OkAbort,
ContentTitle = "Title",
ContentMessage = "Message",
Icon = Icon.Plus,
Style = Style.UbuntuLinux
});
msBoxStandardWindow.Show();
var msBoxStandardWindow = MessageBox.Avalonia.MessageBoxManager
.GetMessageBoxStandardWindow(new MessageBoxStandardParams{
ButtonDefinitions = ButtonEnum.OkAbort,
ContentTitle = "Title",
ContentMessage = "Message",
Icon = Icon.Plus,
Style = Style.UbuntuLinux
});
msBoxStandardWindow.Show();
or I can use this one, but regardless to what style I choose, I don't know how to implement the logic, or where to put the logic, for checking the repo version against the local version
Angius
Angius11mo ago
On app startup, for example As for how... call the Github API Using HttpClient
Mekasu0124
Mekasu012411mo ago
app.axaml.cs? or mainwindowviewmodel.cs
Angius
Angius11mo ago
¯\_(ツ)_/¯ Probably the main window?
Mekasu0124
Mekasu012411mo ago
I don't know either nvm it'llbe ok. Those who download my app can just give me their emails or something and I'll manually let them know of updates. thanks for the help
Denis
Denis11mo ago
That's what the creator of Moq said kekw
Accord
Accord11mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts