Created
September 1, 2021 22:30
-
-
Save MartinZikmund/afc3c9470dad357218552e1d884acc97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class BadgeUpdater | |
{ | |
private const string JsType = "Windows.UI.Notifications.BadgeUpdater"; | |
partial void SetBadge(string? value) | |
{ | |
if (int.TryParse(value, out var number)) | |
{ | |
WebAssemblyRuntime.InvokeJS($"{JsType}.setNumber({number})"); | |
} | |
else | |
{ | |
WebAssemblyRuntime.InvokeJS($"{JsType}.clear()"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment