Skip to content

Commit a52ad35

Browse files
committed
Use Type aliasing instead of macros
The .NET Formatter breaks in these scenarios. Improves maintainability of code in the long run.
1 parent aa5f174 commit a52ad35

File tree

2 files changed

+23
-38
lines changed

2 files changed

+23
-38
lines changed

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

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
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+
#pragma warning disable SA1121 // UseBuiltInTypeAlias
6+
7+
using System;
8+
using Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements;
9+
510
#if WINRT
611
using System.Collections.Generic;
12+
using BindableProgressBarValue = Microsoft.Toolkit.Uwp.Notifications.AdaptiveProgressBarValue;
13+
using BindableString = System.String;
14+
#else
15+
using BindableProgressBarValue = Microsoft.Toolkit.Uwp.Notifications.BindableProgressBarValue;
16+
using BindableString = Microsoft.Toolkit.Uwp.Notifications.BindableString;
717
#endif
8-
using System;
9-
using Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements;
1018

1119
namespace Microsoft.Toolkit.Uwp.Notifications
1220
{
@@ -25,46 +33,22 @@ public sealed class AdaptiveProgressBar : IToastBindingGenericChild
2533
/// <summary>
2634
/// Gets or sets an optional title string. Supports data binding.
2735
/// </summary>
28-
public
29-
#if WINRT
30-
string
31-
#else
32-
BindableString
33-
#endif
34-
Title { get; set; }
36+
public BindableString Title { get; set; }
3537

3638
/// <summary>
3739
/// Gets or sets the value of the progress bar. Supports data binding. Defaults to 0.
3840
/// </summary>
39-
public
40-
#if WINRT
41-
AdaptiveProgressBarValue
42-
#else
43-
BindableProgressBarValue
44-
#endif
45-
Value { get; set; } = AdaptiveProgressBarValue.FromValue(0);
41+
public BindableProgressBarValue Value { get; set; } = AdaptiveProgressBarValue.FromValue(0);
4642

4743
/// <summary>
4844
/// Gets or sets an optional string to be displayed instead of the default percentage string. If this isn't provided, something like "70%" will be displayed.
4945
/// </summary>
50-
public
51-
#if WINRT
52-
string
53-
#else
54-
BindableString
55-
#endif
56-
ValueStringOverride { get; set; }
46+
public BindableString ValueStringOverride { get; set; }
5747

5848
/// <summary>
5949
/// Gets or sets a status string (Required), which is displayed underneath the progress bar. This string should reflect the status of the operation, like "Downloading..." or "Installing..."
6050
/// </summary>
61-
public
62-
#if WINRT
63-
string
64-
#else
65-
BindableString
66-
#endif
67-
Status { get; set; }
51+
public BindableString Status { get; set; }
6852

6953
internal Element_AdaptiveProgressBar ConvertToElement()
7054
{

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
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+
#pragma warning disable SA1121 // UseBuiltInTypeAlias
6+
7+
using System;
8+
using Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements;
9+
510
#if WINRT
611
using System.Collections.Generic;
12+
using BindableString = System.String;
13+
#else
14+
using BindableString = Microsoft.Toolkit.Uwp.Notifications.BindableString;
715
#endif
8-
using Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements;
916

1017
namespace Microsoft.Toolkit.Uwp.Notifications
1118
{
@@ -29,13 +36,7 @@ public sealed class AdaptiveText
2936
/// Gets or sets the text to display. Data binding support added in Creators Update,
3037
/// only works for toast top-level text elements.
3138
/// </summary>
32-
public
33-
#if WINRT
34-
string
35-
#else
36-
BindableString
37-
#endif
38-
Text { get; set; }
39+
public BindableString Text { get; set; }
3940

4041
/// <summary>
4142
/// Gets or sets the target locale of the XML payload, specified as a BCP-47 language tags

0 commit comments

Comments
 (0)