This file contains hidden or 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
| var s="var s={0}{1}{0};System.Console.Write(s,(char)34,s);";System.Console.Write(s,(char)34,s); |
This file contains hidden or 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
| class c{static void Main(){var s="class c{{static void Main(){{var s={0}{1}{0};System.Console.Write(s,(char)34,s);}}}}";System.Console.Write(s,(char)34,s);}} |
This file contains hidden or 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
| class c | |
| { | |
| static void Main() | |
| { | |
| var s = "class c{{static void Main(){{var s={0}{1}{0};System.Console.Write(s,(char)34,s);}}}}"; | |
| System.Console.Write(s, (char)34, s); | |
| } | |
| } |
This file contains hidden or 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
| interface Navigator { | |
| setAppBadge(value: number): void; | |
| clearAppBadge(): void; | |
| } | |
| namespace Windows.UI.Notifications { | |
| export class BadgeUpdater { | |
| public static setNumber(value: number) { | |
| if (navigator.setAppBadge) { | |
| navigator.setAppBadge(value); |
This file contains hidden or 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})"); | |
| } |
This file contains hidden or 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 BadgeNodeXPath = "/badge"; | |
| private const string ValueAttribute = "value"; | |
| internal BadgeUpdater() | |
| { | |
| InitPlatform(); | |
| } |
This file contains hidden or 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 static partial class BadgeUpdateManager | |
| { | |
| public static BadgeUpdater CreateBadgeUpdaterForApplication() => new BadgeUpdater(); | |
| public static XmlDocument GetTemplateContent(BadgeTemplateType type) | |
| { | |
| // Although UWP has two "template types", both return the same XML. | |
| var xml = new XmlDocument(); | |
| xml.LoadXml("<badge value=\"\" />"); | |
| return xml; |
This file contains hidden or 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
| namespace Windows.UI.Notifications | |
| { | |
| public partial class BadgeNotification | |
| { | |
| public BadgeNotification(XmlDocument content) | |
| { | |
| Content = content ?? throw new ArgumentNullException(nameof(content)); | |
| } | |
| public XmlDocument Content { get; } |
This file contains hidden or 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
| var badgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber); | |
| XmlElement badgeElement = badgeXml.SelectSingleNode("/badge") as XmlElement; | |
| badgeElement.SetAttribute("value", BadgeTextBox.Text); | |
| var badgeNotification = new BadgeNotification(badgeXml); | |
| BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeNotification); |
This file contains hidden or 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
| await navigator.setAppBadge(42); // Sets the app badge to 42 | |
| await navigator.clearAppBadge(); // Clears the app badge |