diff --git a/Microsoft.Toolkit.Uwp.Notifications/Common/EnumFormatter.cs b/Microsoft.Toolkit.Uwp.Notifications/Common/EnumFormatter.cs index 197b0c8ef46..d7271537450 100644 --- a/Microsoft.Toolkit.Uwp.Notifications/Common/EnumFormatter.cs +++ b/Microsoft.Toolkit.Uwp.Notifications/Common/EnumFormatter.cs @@ -6,51 +6,52 @@ #nullable enable -namespace Microsoft.Toolkit.Uwp.Notifications; - -/// -/// A helper class that can be used to format values. -/// -internal static class EnumFormatter +namespace Microsoft.Toolkit.Uwp.Notifications { /// - /// Returns a representation of an enum value with pascal casing. + /// A helper class that can be used to format values. /// - /// The type to format. - /// The value to format. - /// The pascal case representation of . - public static string? ToPascalCaseString(this T? value) - where T : unmanaged, Enum + internal static class EnumFormatter { - if (value is null) + /// + /// Returns a representation of an enum value with pascal casing. + /// + /// The type to format. + /// The value to format. + /// The pascal case representation of . + public static string? ToPascalCaseString(this T? value) + where T : unmanaged, Enum { - return null; + if (value is null) + { + return null; + } + + return ToPascalCaseString(value.Value); } - return ToPascalCaseString(value.Value); - } + /// + /// Returns a representation of an enum value with pascal casing. + /// + /// The type to format. + /// The value to format. + /// The pascal case representation of . + public static string? ToPascalCaseString(this T value) + where T : unmanaged, Enum + { + string? text = value.ToString(); - /// - /// Returns a representation of an enum value with pascal casing. - /// - /// The type to format. - /// The value to format. - /// The pascal case representation of . - public static string? ToPascalCaseString(this T value) - where T : unmanaged, Enum - { - string? text = value.ToString(); + if (text is null or { Length: 0 }) + { + return text; + } - if (text is null or { Length: 0 }) - { - return text; - } + if (text is { Length: 1 }) + { + return text.ToLowerInvariant(); + } - if (text is { Length: 1 }) - { - return text.ToLowerInvariant(); + return $"{char.ToLowerInvariant(text[0])}{text.Substring(1)}"; } - - return $"{char.ToLowerInvariant(text[0])}{text.Substring(1)}"; } } \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlAdditionalProperties.cs b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlAdditionalProperties.cs index 6c5d85d3b38..cb11d04ca57 100644 --- a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlAdditionalProperties.cs +++ b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlAdditionalProperties.cs @@ -6,15 +6,16 @@ #nullable enable -namespace Microsoft.Toolkit.Uwp.Notifications; - -/// -/// An interface for a notification XML element with additional properties. -/// -internal interface IHaveXmlAdditionalProperties +namespace Microsoft.Toolkit.Uwp.Notifications { /// - /// Gets the mapping of additional properties. + /// An interface for a notification XML element with additional properties. /// - IReadOnlyDictionary AdditionalProperties { get; } -} \ No newline at end of file + internal interface IHaveXmlAdditionalProperties + { + /// + /// Gets the mapping of additional properties. + /// + IReadOnlyDictionary AdditionalProperties { get; } + } +} diff --git a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlChildren.cs b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlChildren.cs index 9bc07e8a099..e97000d3b81 100644 --- a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlChildren.cs +++ b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlChildren.cs @@ -6,15 +6,16 @@ #nullable enable -namespace Microsoft.Toolkit.Uwp.Notifications; - -/// -/// An interface for a notification XML element with additional children. -/// -internal interface IHaveXmlChildren +namespace Microsoft.Toolkit.Uwp.Notifications { /// - /// Gets the children of the current element. + /// An interface for a notification XML element with additional children. /// - IEnumerable Children { get; } + internal interface IHaveXmlChildren + { + /// + /// Gets the children of the current element. + /// + IEnumerable Children { get; } + } } \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlContent.cs b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlContent.cs deleted file mode 100644 index 1ffab08022c..00000000000 --- a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlContent.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Uwp.Notifications; - -/// -/// An interface for a notification XML element with an explicit XML text content. -/// -internal interface IHaveXmlText -{ - /// - /// Gets the text content of the current element. - /// - string Text { get; } -} diff --git a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlName.cs b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlName.cs index fc6b25e8490..82c8308e78d 100644 --- a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlName.cs +++ b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlName.cs @@ -2,15 +2,16 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -namespace Microsoft.Toolkit.Uwp.Notifications; - -/// -/// An interface for a notification XML element with a name. -/// -internal interface IHaveXmlName +namespace Microsoft.Toolkit.Uwp.Notifications { /// - /// Gets the name of the current element. + /// An interface for a notification XML element with a name. /// - string Name { get; } + internal interface IHaveXmlName + { + /// + /// Gets the name of the current element. + /// + string Name { get; } + } } diff --git a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlNamedProperties.cs b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlNamedProperties.cs index 9322746075d..5dcc7549f4f 100644 --- a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlNamedProperties.cs +++ b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlNamedProperties.cs @@ -6,17 +6,18 @@ #nullable enable -namespace Microsoft.Toolkit.Uwp.Notifications; - -/// -/// An interface for a notification XML element with named properties. -/// -internal interface IHaveXmlNamedProperties +namespace Microsoft.Toolkit.Uwp.Notifications { /// - /// Enumerates the available named properties for the element. + /// An interface for a notification XML element with named properties. /// - /// A sequence of named properties for the element. - /// The returned values must be valid XML values when is called on them. - IEnumerable> EnumerateNamedProperties(); + internal interface IHaveXmlNamedProperties + { + /// + /// Enumerates the available named properties for the element. + /// + /// A sequence of named properties for the element. + /// The returned values must be valid XML values when is called on them. + IEnumerable> EnumerateNamedProperties(); + } } diff --git a/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlText.cs b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlText.cs new file mode 100644 index 00000000000..de7352073f2 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlText.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.Toolkit.Uwp.Notifications +{ + /// + /// An interface for a notification XML element with an explicit XML text content. + /// + internal interface IHaveXmlText + { + /// + /// Gets the text content of the current element. + /// + string Text { get; } + } +}