Skip to content

AzureAms/ToastNotification.Uno

Repository files navigation

Uno.Extras.ToastNotification

Basic ToastNotification for the Uno Platform.
Provides basic, signature-compatible APIs with Microsoft.Toolkit.Uwp.Notifications, for the Uno Platform.
BuildStatus
Codacy Badge

Package Version
Cross platform CrossPlatformShield
WPF WpfShield
WASM WasmShield
GTK WasmShield

Usage

#if __ANDROID__
            var logoSource = new LogoSource(new Uri("ms-appx:///sample.png"));
#else
            var logoSource = new LogoSource(new Uri("ms-appx:///Assets/sample.png"));
#endif
            logoSource.Dispose();

            await new ToastNotification()
                .AddAppLogoOverride(logoSource)
                .AddText("Toaster with buttons")
                .AddText("Hello world!")
                .AddText("Wanna play with me?")
                .AddButton(new ToastButton()
                    .SetContent("Let's go!")
                    .AddArgument("ShouldPlay", true)
                    )
                .AddButton(new ToastButton()
                    .SetContent("Another time")
                    .SetDismissActivation()
                    )
                .Show();

Notes

  • Help is wanted in providing support for Tizen. Pull requests are welcome.
  • Support for macOS is implemented using deprecated APIs. Please help us fix this by fixing #21.
  • iOS notifications are implemented, but not tested. Please report any issues.
  • You can extend the functionality of this library to unsupported platforms by creating an extension method Show(ToastNotification toast).