Skip to content

Commit d2d708b

Browse files
committed
Switch to file-scoped namespaces
1 parent d6c144b commit d2d708b

File tree

124 files changed

+12092
-12214
lines changed

Some content is hidden

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

124 files changed

+12092
-12214
lines changed

components/Notifications/src/Adaptive/AdaptiveGroup.cs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,35 @@
66
using System.Collections.Generic;
77
using CommunityToolkit.Notifications.Adaptive.Elements;
88

9-
namespace CommunityToolkit.Notifications
9+
namespace CommunityToolkit.Notifications;
10+
11+
/// <summary>
12+
/// Groups semantically identify that the content in the group must either be displayed as a whole, or not displayed if it cannot fit. Groups also allow creating multiple columns. Supported on Tiles since RTM. Supported on Toasts since Anniversary Update.
13+
/// </summary>
14+
public sealed class AdaptiveGroup : ITileBindingContentAdaptiveChild, IAdaptiveChild, IToastBindingGenericChild
1015
{
1116
/// <summary>
12-
/// Groups semantically identify that the content in the group must either be displayed as a whole, or not displayed if it cannot fit. Groups also allow creating multiple columns. Supported on Tiles since RTM. Supported on Toasts since Anniversary Update.
17+
/// Gets the only valid children of groups are <see cref="AdaptiveSubgroup"/>.
18+
/// Each subgroup is displayed as a separate vertical column. Note that you must
19+
/// include at least one subgroup in your group, otherwise an <see cref="InvalidOperationException"/>
20+
/// will be thrown when you try to retrieve the XML for the notification.
1321
/// </summary>
14-
public sealed class AdaptiveGroup : ITileBindingContentAdaptiveChild, IAdaptiveChild, IToastBindingGenericChild
15-
{
16-
/// <summary>
17-
/// Gets the only valid children of groups are <see cref="AdaptiveSubgroup"/>.
18-
/// Each subgroup is displayed as a separate vertical column. Note that you must
19-
/// include at least one subgroup in your group, otherwise an <see cref="InvalidOperationException"/>
20-
/// will be thrown when you try to retrieve the XML for the notification.
21-
/// </summary>
22-
public IList<AdaptiveSubgroup> Children { get; private set; } = new List<AdaptiveSubgroup>();
22+
public IList<AdaptiveSubgroup> Children { get; private set; } = new List<AdaptiveSubgroup>();
2323

24-
internal Element_AdaptiveGroup ConvertToElement()
24+
internal Element_AdaptiveGroup ConvertToElement()
25+
{
26+
if (Children.Count == 0)
2527
{
26-
if (Children.Count == 0)
27-
{
28-
throw new InvalidOperationException("Groups must have at least one child subgroup. The Children property had zero items in it.");
29-
}
30-
31-
Element_AdaptiveGroup group = new Element_AdaptiveGroup();
28+
throw new InvalidOperationException("Groups must have at least one child subgroup. The Children property had zero items in it.");
29+
}
3230

33-
foreach (var subgroup in Children)
34-
{
35-
group.Children.Add(subgroup.ConvertToElement());
36-
}
31+
Element_AdaptiveGroup group = new Element_AdaptiveGroup();
3732

38-
return group;
33+
foreach (var subgroup in Children)
34+
{
35+
group.Children.Add(subgroup.ConvertToElement());
3936
}
37+
38+
return group;
4039
}
4140
}

components/Notifications/src/Adaptive/AdaptiveHelper.cs

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,37 @@
44

55
using System;
66

7-
namespace CommunityToolkit.Notifications.Adaptive
7+
namespace CommunityToolkit.Notifications.Adaptive;
8+
9+
internal static class AdaptiveHelper
810
{
9-
internal static class AdaptiveHelper
11+
internal static object ConvertToElement(object obj)
1012
{
11-
internal static object ConvertToElement(object obj)
13+
if (obj is AdaptiveText)
14+
{
15+
return (obj as AdaptiveText).ConvertToElement();
16+
}
17+
18+
if (obj is AdaptiveImage)
19+
{
20+
return (obj as AdaptiveImage).ConvertToElement();
21+
}
22+
23+
if (obj is AdaptiveGroup)
1224
{
13-
if (obj is AdaptiveText)
14-
{
15-
return (obj as AdaptiveText).ConvertToElement();
16-
}
17-
18-
if (obj is AdaptiveImage)
19-
{
20-
return (obj as AdaptiveImage).ConvertToElement();
21-
}
22-
23-
if (obj is AdaptiveGroup)
24-
{
25-
return (obj as AdaptiveGroup).ConvertToElement();
26-
}
27-
28-
if (obj is AdaptiveSubgroup)
29-
{
30-
return (obj as AdaptiveSubgroup).ConvertToElement();
31-
}
32-
33-
if (obj is AdaptiveProgressBar)
34-
{
35-
return (obj as AdaptiveProgressBar).ConvertToElement();
36-
}
37-
38-
throw new NotImplementedException("Unknown object: " + obj.GetType());
25+
return (obj as AdaptiveGroup).ConvertToElement();
3926
}
27+
28+
if (obj is AdaptiveSubgroup)
29+
{
30+
return (obj as AdaptiveSubgroup).ConvertToElement();
31+
}
32+
33+
if (obj is AdaptiveProgressBar)
34+
{
35+
return (obj as AdaptiveProgressBar).ConvertToElement();
36+
}
37+
38+
throw new NotImplementedException("Unknown object: " + obj.GetType());
4039
}
4140
}

components/Notifications/src/Adaptive/AdaptiveImage.cs

Lines changed: 68 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,89 +4,88 @@
44

55
using CommunityToolkit.Notifications.Adaptive.Elements;
66

7-
namespace CommunityToolkit.Notifications
7+
namespace CommunityToolkit.Notifications;
8+
9+
/// <summary>
10+
/// An inline image.
11+
/// </summary>
12+
public sealed class AdaptiveImage
13+
: IBaseImage,
14+
IToastBindingGenericChild,
15+
ITileBindingContentAdaptiveChild,
16+
IAdaptiveChild,
17+
IAdaptiveSubgroupChild
818
{
919
/// <summary>
10-
/// An inline image.
20+
/// Gets or sets the desired cropping of the image.
21+
/// Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
1122
/// </summary>
12-
public sealed class AdaptiveImage
13-
: IBaseImage,
14-
IToastBindingGenericChild,
15-
ITileBindingContentAdaptiveChild,
16-
IAdaptiveChild,
17-
IAdaptiveSubgroupChild
18-
{
19-
/// <summary>
20-
/// Gets or sets the desired cropping of the image.
21-
/// Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
22-
/// </summary>
23-
public AdaptiveImageCrop HintCrop { get; set; }
23+
public AdaptiveImageCrop HintCrop { get; set; }
2424

25-
/// <summary>
26-
/// Gets or sets a value whether a margin is removed. images have an 8px margin around them.
27-
/// You can remove this margin by setting this property to true.
28-
/// Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
29-
/// </summary>
30-
public bool? HintRemoveMargin { get; set; }
25+
/// <summary>
26+
/// Gets or sets a value whether a margin is removed. images have an 8px margin around them.
27+
/// You can remove this margin by setting this property to true.
28+
/// Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
29+
/// </summary>
30+
public bool? HintRemoveMargin { get; set; }
3131

32-
/// <summary>
33-
/// Gets or sets the horizontal alignment of the image.
34-
/// For Toast, this is only supported when inside an <see cref="AdaptiveSubgroup"/>.
35-
/// </summary>
36-
public AdaptiveImageAlign HintAlign { get; set; }
32+
/// <summary>
33+
/// Gets or sets the horizontal alignment of the image.
34+
/// For Toast, this is only supported when inside an <see cref="AdaptiveSubgroup"/>.
35+
/// </summary>
36+
public AdaptiveImageAlign HintAlign { get; set; }
3737

38-
private string _source;
38+
private string _source;
3939

40-
/// <summary>
41-
/// Gets or sets the URI of the image (Required).
42-
/// Can be from your application package, application data, or the internet.
43-
/// Internet images must be less than 200 KB in size.
44-
/// </summary>
45-
public string Source
46-
{
47-
get { return _source; }
48-
set { BaseImageHelper.SetSource(ref _source, value); }
49-
}
40+
/// <summary>
41+
/// Gets or sets the URI of the image (Required).
42+
/// Can be from your application package, application data, or the internet.
43+
/// Internet images must be less than 200 KB in size.
44+
/// </summary>
45+
public string Source
46+
{
47+
get { return _source; }
48+
set { BaseImageHelper.SetSource(ref _source, value); }
49+
}
5050

51-
/// <summary>
52-
/// Gets or sets a description of the image, for users of assistive technologies.
53-
/// </summary>
54-
public string AlternateText { get; set; }
51+
/// <summary>
52+
/// Gets or sets a description of the image, for users of assistive technologies.
53+
/// </summary>
54+
public string AlternateText { get; set; }
5555

56-
/// <summary>
57-
/// Gets or sets set to true to allow Windows to append a query string to the image URI
58-
/// supplied in the Tile notification. Use this attribute if your server hosts
59-
/// images and can handle query strings, either by retrieving an image variant based
60-
/// on the query strings or by ignoring the query string and returning the image
61-
/// as specified without the query string. This query string specifies scale,
62-
/// contrast setting, and language.
63-
/// </summary>
64-
public bool? AddImageQuery { get; set; }
56+
/// <summary>
57+
/// Gets or sets set to true to allow Windows to append a query string to the image URI
58+
/// supplied in the Tile notification. Use this attribute if your server hosts
59+
/// images and can handle query strings, either by retrieving an image variant based
60+
/// on the query strings or by ignoring the query string and returning the image
61+
/// as specified without the query string. This query string specifies scale,
62+
/// contrast setting, and language.
63+
/// </summary>
64+
public bool? AddImageQuery { get; set; }
6565

66-
/// <summary>
67-
/// Returns the image's source string.
68-
/// </summary>
69-
/// <returns>The image's source string.</returns>
70-
public override string ToString()
66+
/// <summary>
67+
/// Returns the image's source string.
68+
/// </summary>
69+
/// <returns>The image's source string.</returns>
70+
public override string ToString()
71+
{
72+
if (Source == null)
7173
{
72-
if (Source == null)
73-
{
74-
return "Source is null";
75-
}
76-
77-
return Source;
74+
return "Source is null";
7875
}
7976

80-
internal Element_AdaptiveImage ConvertToElement()
81-
{
82-
Element_AdaptiveImage image = BaseImageHelper.CreateBaseElement(this);
77+
return Source;
78+
}
8379

84-
image.Crop = HintCrop;
85-
image.RemoveMargin = HintRemoveMargin;
86-
image.Align = HintAlign;
87-
image.Placement = AdaptiveImagePlacement.Inline;
80+
internal Element_AdaptiveImage ConvertToElement()
81+
{
82+
Element_AdaptiveImage image = BaseImageHelper.CreateBaseElement(this);
8883

89-
return image;
90-
}
84+
image.Crop = HintCrop;
85+
image.RemoveMargin = HintRemoveMargin;
86+
image.Align = HintAlign;
87+
image.Placement = AdaptiveImagePlacement.Inline;
88+
89+
return image;
9190
}
9291
}

components/Notifications/src/Adaptive/AdaptiveImageEnums.cs

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,56 @@
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-
namespace CommunityToolkit.Notifications
5+
namespace CommunityToolkit.Notifications;
6+
7+
/// <summary>
8+
/// Specifies the horizontal alignment for an image.
9+
/// </summary>
10+
public enum AdaptiveImageAlign
11+
{
12+
/// <summary>
13+
/// Default value, alignment behavior determined by renderer.
14+
/// </summary>
15+
Default,
16+
17+
/// <summary>
18+
/// Image stretches to fill available width (and potentially available height too, depending on where the image is).
19+
/// </summary>
20+
Stretch,
21+
22+
/// <summary>
23+
/// Align the image to the left, displaying the image at its native resolution.
24+
/// </summary>
25+
Left,
26+
27+
/// <summary>
28+
/// Align the image in the center horizontally, displaying the image at its native resolution.
29+
/// </summary>
30+
Center,
31+
32+
/// <summary>
33+
/// Align the image to the right, displaying the image at its native resolution.
34+
/// </summary>
35+
Right
36+
}
37+
38+
/// <summary>
39+
/// Specify the desired cropping of the image.
40+
/// </summary>
41+
public enum AdaptiveImageCrop
642
{
743
/// <summary>
8-
/// Specifies the horizontal alignment for an image.
9-
/// </summary>
10-
public enum AdaptiveImageAlign
11-
{
12-
/// <summary>
13-
/// Default value, alignment behavior determined by renderer.
14-
/// </summary>
15-
Default,
16-
17-
/// <summary>
18-
/// Image stretches to fill available width (and potentially available height too, depending on where the image is).
19-
/// </summary>
20-
Stretch,
21-
22-
/// <summary>
23-
/// Align the image to the left, displaying the image at its native resolution.
24-
/// </summary>
25-
Left,
26-
27-
/// <summary>
28-
/// Align the image in the center horizontally, displaying the image at its native resolution.
29-
/// </summary>
30-
Center,
31-
32-
/// <summary>
33-
/// Align the image to the right, displaying the image at its native resolution.
34-
/// </summary>
35-
Right
36-
}
37-
38-
/// <summary>
39-
/// Specify the desired cropping of the image.
40-
/// </summary>
41-
public enum AdaptiveImageCrop
42-
{
43-
/// <summary>
44-
/// Default value, cropping behavior determined by renderer.
45-
/// </summary>
46-
Default,
47-
48-
/// <summary>
49-
/// Image is not cropped.
50-
/// </summary>
51-
None,
52-
53-
/// <summary>
54-
/// Image is cropped to a circle shape.
55-
/// </summary>
56-
Circle
57-
}
44+
/// Default value, cropping behavior determined by renderer.
45+
/// </summary>
46+
Default,
47+
48+
/// <summary>
49+
/// Image is not cropped.
50+
/// </summary>
51+
None,
52+
53+
/// <summary>
54+
/// Image is cropped to a circle shape.
55+
/// </summary>
56+
Circle
5857
}

0 commit comments

Comments
 (0)