-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hosts rewrite. #270
Hosts rewrite. #270
Conversation
Got the old SukiHost working as it was whilst I rewrite the API.
Still a couple pretty bad bugs with DialogHost locking up but I know what's causing them.
The action buttons seems to mix between toasts sometimes : Also, we need a way, a "shortcut", to quickly use toasts and dialogs in the current window without MVVM for guys who just want to quickly display a message in a simple app. Maybe just give this kind of dirty snippet in a method
I know you won't like it ☠️ Otherwise this is great, especially calling toast like this This is perfection. Don't worry about the syling I will correct it at the end. |
I don't think there's a huge need to add a hacky workaround to the library, it's very easy to just implement it yourself if you don't want to bother with MVVM. I can add this workaround to the docs for people who want to have a lazy way to do it. Also this is basically how you should do it if you're not doing MVVM anyway. <SukiWindow.Hosts>
<SukiToastHost Name="ToastHost"/>
</SukiWindow.Hosts> public class MainWindow : SukiWindow
{
public static ISukiToastManager ToastManager = new SukiToastManager();
public MainWindow()
{
ToastHost.Manager = ToastManager;
}
}
// and then...
MainWindow.ToastManager.CreateToast()
.Queue(); Button bleed is easily fixed, just an oversight with the pooling and I think I have an idea for how to fix the toast limits too so I'll get that done as well later on today when I get back. |
I agree, adding that to the doc will be enough 👍 |
This is mostly complete now I think. I believe that adding new features/styling elements to dialogs and toasts should be much easier now and limit the breaking changes introduced going forward. You can implement whatever visual changes you need to the |
Had to resolve a conflict manually but it seems to be okay |
I'm not sure how you merged the PR without actually merging it, should it be closed? |
Major Changes
SukiHost
is no more. That single object was quickly turning into a nightmare.Hosts
property toSukiWindow
so people can choose which hosts they do or don't want and implement their own window-level host style controls as needed.Avalonia.Notification
API, for people familiar with that this will be far easier to pick up.Window
instances.SukiToastHost
to be used anywhere or nowhere, you can now have toasts inside a button if you want.SukiHost.ShowToast
.ActionButtons
within a toast.Action Toasts
in the demo of this PR.ViewModel
and then it just renders that only, so any custom dialog is possible without having to jump through hoops.Outstanding Issues
PR Addresses: #266