Skip to content

Commit 306ebd5

Browse files
authored
Merge branch 'main' into fabricbot-configuration-migration
2 parents d096e7e + c4d62ee commit 306ebd5

File tree

60 files changed

+683
-578
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+683
-578
lines changed

Microsoft.Toolkit.Uwp.Notifications/Adaptive/AdaptiveImageEnums.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,21 @@ public enum AdaptiveImageAlign
1717
/// <summary>
1818
/// Image stretches to fill available width (and potentially available height too, depending on where the image is).
1919
/// </summary>
20-
[EnumString("stretch")]
2120
Stretch,
2221

2322
/// <summary>
2423
/// Align the image to the left, displaying the image at its native resolution.
2524
/// </summary>
26-
[EnumString("left")]
2725
Left,
2826

2927
/// <summary>
3028
/// Align the image in the center horizontally, displaying the image at its native resolution.
3129
/// </summary>
32-
[EnumString("center")]
3330
Center,
3431

3532
/// <summary>
3633
/// Align the image to the right, displaying the image at its native resolution.
3734
/// </summary>
38-
[EnumString("right")]
3935
Right
4036
}
4137

@@ -52,13 +48,11 @@ public enum AdaptiveImageCrop
5248
/// <summary>
5349
/// Image is not cropped.
5450
/// </summary>
55-
[EnumString("none")]
5651
None,
5752

5853
/// <summary>
5954
/// Image is cropped to a circle shape.
6055
/// </summary>
61-
[EnumString("circle")]
6256
Circle
6357
}
6458
}

Microsoft.Toolkit.Uwp.Notifications/Adaptive/AdaptiveSubgroupEnums.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,16 @@ public enum AdaptiveSubgroupTextStacking
1717
/// <summary>
1818
/// Vertical align to the top.
1919
/// </summary>
20-
[EnumString("top")]
2120
Top,
2221

2322
/// <summary>
2423
/// Vertical align to the center.
2524
/// </summary>
26-
[EnumString("center")]
2725
Center,
2826

2927
/// <summary>
3028
/// Vertical align to the bottom.
3129
/// </summary>
32-
[EnumString("bottom")]
3330
Bottom
3431
}
3532
}

Microsoft.Toolkit.Uwp.Notifications/Adaptive/AdaptiveTextEnums.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,103 +17,86 @@ public enum AdaptiveTextStyle
1717
/// <summary>
1818
/// Default value. Paragraph font size, normal weight and opacity.
1919
/// </summary>
20-
[EnumString("caption")]
2120
Caption,
2221

2322
/// <summary>
2423
/// Same as Caption but with subtle opacity.
2524
/// </summary>
26-
[EnumString("captionSubtle")]
2725
CaptionSubtle,
2826

2927
/// <summary>
3028
/// H5 font size.
3129
/// </summary>
32-
[EnumString("body")]
3330
Body,
3431

3532
/// <summary>
3633
/// Same as Body but with subtle opacity.
3734
/// </summary>
38-
[EnumString("bodySubtle")]
3935
BodySubtle,
4036

4137
/// <summary>
4238
/// H5 font size, bold weight. Essentially the bold version of Body.
4339
/// </summary>
44-
[EnumString("base")]
4540
Base,
4641

4742
/// <summary>
4843
/// Same as Base but with subtle opacity.
4944
/// </summary>
50-
[EnumString("baseSubtle")]
5145
BaseSubtle,
5246

5347
/// <summary>
5448
/// H4 font size.
5549
/// </summary>
56-
[EnumString("subtitle")]
5750
Subtitle,
5851

5952
/// <summary>
6053
/// Same as Subtitle but with subtle opacity.
6154
/// </summary>
62-
[EnumString("subtitleSubtle")]
6355
SubtitleSubtle,
6456

6557
/// <summary>
6658
/// H3 font size.
6759
/// </summary>
68-
[EnumString("title")]
6960
Title,
7061

7162
/// <summary>
7263
/// Same as Title but with subtle opacity.
7364
/// </summary>
74-
[EnumString("titleSubtle")]
7565
TitleSubtle,
7666

7767
/// <summary>
7868
/// Same as Title but with top/bottom padding removed.
7969
/// </summary>
80-
[EnumString("titleNumeral")]
8170
TitleNumeral,
8271

8372
/// <summary>
8473
/// H2 font size.
8574
/// </summary>
86-
[EnumString("subheader")]
8775
Subheader,
8876

8977
/// <summary>
9078
/// Same as Subheader but with subtle opacity.
9179
/// </summary>
92-
[EnumString("subheaderSubtle")]
9380
SubheaderSubtle,
9481

9582
/// <summary>
9683
/// Same as Subheader but with top/bottom padding removed.
9784
/// </summary>
98-
[EnumString("subheaderNumeral")]
9985
SubheaderNumeral,
10086

10187
/// <summary>
10288
/// H1 font size.
10389
/// </summary>
104-
[EnumString("header")]
10590
Header,
10691

10792
/// <summary>
10893
/// Same as Header but with subtle opacity.
10994
/// </summary>
110-
[EnumString("headerSubtle")]
11195
HeaderSubtle,
11296

11397
/// <summary>
11498
/// Same as Header but with top/bottom padding removed.
11599
/// </summary>
116-
[EnumString("headerNumeral")]
117100
HeaderNumeral
118101
}
119102

@@ -130,25 +113,21 @@ public enum AdaptiveTextAlign
130113
/// <summary>
131114
/// The system automatically decides the alignment based on the language and culture.
132115
/// </summary>
133-
[EnumString("auto")]
134116
Auto,
135117

136118
/// <summary>
137119
/// Horizontally align the text to the left.
138120
/// </summary>
139-
[EnumString("left")]
140121
Left,
141122

142123
/// <summary>
143124
/// Horizontally align the text in the center.
144125
/// </summary>
145-
[EnumString("center")]
146126
Center,
147127

148128
/// <summary>
149129
/// Horizontally align the text to the right.
150130
/// </summary>
151-
[EnumString("right")]
152131
Right
153132
}
154133

@@ -158,8 +137,6 @@ internal enum AdaptiveTextPlacement
158137
/// Default value
159138
/// </summary>
160139
Inline,
161-
162-
[EnumString("attribution")]
163140
Attribution
164141
}
165142
}

Microsoft.Toolkit.Uwp.Notifications/Adaptive/Elements/Element_AdaptiveGroup.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
namespace Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements
88
{
9-
[NotificationXmlElement("group")]
10-
internal sealed class Element_AdaptiveGroup : IElement_TileBindingChild, IElement_ToastBindingChild, IElementWithDescendants
9+
internal sealed class Element_AdaptiveGroup : IElement_TileBindingChild, IElement_ToastBindingChild, IElementWithDescendants, IHaveXmlName, IHaveXmlChildren
1110
{
1211
public IList<Element_AdaptiveSubgroup> Children { get; private set; } = new List<Element_AdaptiveSubgroup>();
1312

@@ -25,5 +24,11 @@ public IEnumerable<object> Descendants()
2524
}
2625
}
2726
}
27+
28+
/// <inheritdoc/>
29+
string IHaveXmlName.Name => "group";
30+
31+
/// <inheritdoc/>
32+
IEnumerable<object> IHaveXmlChildren.Children => Children;
2833
}
2934
}

Microsoft.Toolkit.Uwp.Notifications/Adaptive/Elements/Element_AdaptiveImage.cs

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,34 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System.Collections.Generic;
6+
57
namespace Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements
68
{
7-
[NotificationXmlElement("image")]
8-
internal sealed class Element_AdaptiveImage : IElement_TileBindingChild, IElement_ToastBindingChild, IElement_AdaptiveSubgroupChild
9+
internal sealed class Element_AdaptiveImage : IElement_TileBindingChild, IElement_ToastBindingChild, IElement_AdaptiveSubgroupChild, IHaveXmlName, IHaveXmlNamedProperties
910
{
1011
internal const AdaptiveImagePlacement DEFAULT_PLACEMENT = AdaptiveImagePlacement.Inline;
1112
internal const AdaptiveImageCrop DEFAULT_CROP = AdaptiveImageCrop.Default;
1213
internal const AdaptiveImageAlign DEFAULT_ALIGN = AdaptiveImageAlign.Default;
1314

14-
[NotificationXmlAttribute("id")]
1515
public int? Id { get; set; }
1616

17-
[NotificationXmlAttribute("src")]
1817
public string Src { get; set; }
1918

20-
[NotificationXmlAttribute("alt")]
2119
public string Alt { get; set; }
2220

23-
[NotificationXmlAttribute("addImageQuery")]
2421
public bool? AddImageQuery { get; set; }
2522

26-
[NotificationXmlAttribute("placement", DEFAULT_PLACEMENT)]
2723
public AdaptiveImagePlacement Placement { get; set; } = DEFAULT_PLACEMENT;
2824

29-
[NotificationXmlAttribute("hint-align", DEFAULT_ALIGN)]
3025
public AdaptiveImageAlign Align { get; set; } = DEFAULT_ALIGN;
3126

32-
[NotificationXmlAttribute("hint-crop", DEFAULT_CROP)]
3327
public AdaptiveImageCrop Crop { get; set; } = DEFAULT_CROP;
3428

35-
[NotificationXmlAttribute("hint-removeMargin")]
3629
public bool? RemoveMargin { get; set; }
3730

3831
private int? _overlay;
3932

40-
[NotificationXmlAttribute("hint-overlay")]
4133
public int? Overlay
4234
{
4335
get
@@ -56,16 +48,46 @@ public int? Overlay
5648
}
5749
}
5850

59-
[NotificationXmlAttribute("spritesheet-src")]
6051
public string SpriteSheetSrc { get; set; }
6152

62-
[NotificationXmlAttribute("spritesheet-height")]
6353
public uint? SpriteSheetHeight { get; set; }
6454

65-
[NotificationXmlAttribute("spritesheet-fps")]
6655
public uint? SpriteSheetFps { get; set; }
6756

68-
[NotificationXmlAttribute("spritesheet-startingFrame")]
6957
public uint? SpriteSheetStartingFrame { get; set; }
58+
59+
/// <inheritdoc/>
60+
string IHaveXmlName.Name => "image";
61+
62+
/// <inheritdoc/>
63+
IEnumerable<KeyValuePair<string, object>> IHaveXmlNamedProperties.EnumerateNamedProperties()
64+
{
65+
yield return new("id", Id);
66+
yield return new("src", Src);
67+
yield return new("alt", Alt);
68+
yield return new("addImageQuery", AddImageQuery);
69+
70+
if (Placement != DEFAULT_PLACEMENT)
71+
{
72+
yield return new("placement", Placement.ToPascalCaseString());
73+
}
74+
75+
if (Align != DEFAULT_ALIGN)
76+
{
77+
yield return new("hint-align", Align.ToPascalCaseString());
78+
}
79+
80+
if (Crop != DEFAULT_CROP)
81+
{
82+
yield return new("hint-crop", Crop.ToPascalCaseString());
83+
}
84+
85+
yield return new("hint-removeMargin", RemoveMargin);
86+
yield return new("hint-overlay", Overlay);
87+
yield return new("spritesheet-src", SpriteSheetSrc);
88+
yield return new("spritesheet-height", SpriteSheetHeight);
89+
yield return new("spritesheet-fps", SpriteSheetFps);
90+
yield return new("spritesheet-startingFrame", SpriteSheetStartingFrame);
91+
}
7092
}
7193
}

Microsoft.Toolkit.Uwp.Notifications/Adaptive/Elements/Element_AdaptiveImageEnums.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,10 @@ namespace Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements
66
{
77
internal enum AdaptiveImagePlacement
88
{
9-
[EnumString("inline")]
109
Inline,
11-
12-
[EnumString("background")]
1310
Background,
14-
15-
[EnumString("peek")]
1611
Peek,
17-
18-
[EnumString("hero")]
1912
Hero,
20-
21-
[EnumString("appLogoOverride")]
2213
AppLogoOverride
2314
}
2415
}

Microsoft.Toolkit.Uwp.Notifications/Adaptive/Elements/Element_AdaptiveProgressBar.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,30 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System.Collections.Generic;
6+
57
namespace Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements
68
{
7-
[NotificationXmlElement("progress")]
8-
internal sealed class Element_AdaptiveProgressBar : IElement_ToastBindingChild
9+
internal sealed class Element_AdaptiveProgressBar : IElement_ToastBindingChild, IHaveXmlName, IHaveXmlNamedProperties
910
{
10-
[NotificationXmlAttribute("value")]
1111
public string Value { get; set; }
1212

13-
[NotificationXmlAttribute("title")]
1413
public string Title { get; set; }
1514

16-
[NotificationXmlAttribute("valueStringOverride")]
1715
public string ValueStringOverride { get; set; }
1816

19-
[NotificationXmlAttribute("status")]
2017
public string Status { get; set; }
18+
19+
/// <inheritdoc/>
20+
string IHaveXmlName.Name => "progress";
21+
22+
/// <inheritdoc/>
23+
IEnumerable<KeyValuePair<string, object>> IHaveXmlNamedProperties.EnumerateNamedProperties()
24+
{
25+
yield return new("value", Value);
26+
yield return new("title", Title);
27+
yield return new("valueStringOverride", ValueStringOverride);
28+
yield return new("status", Status);
29+
}
2130
}
2231
}

0 commit comments

Comments
 (0)