Skip to content

Commit

Permalink
Use Type aliasing instead of macros
Browse files Browse the repository at this point in the history
The .NET Formatter breaks in these scenarios.
Improves maintainability of code in the long run.
  • Loading branch information
Nirmal4G committed Jun 4, 2021
1 parent aa5f174 commit a52ad35
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 38 deletions.
44 changes: 14 additions & 30 deletions Microsoft.Toolkit.Uwp.Notifications/Adaptive/AdaptiveProgressBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#pragma warning disable SA1121 // UseBuiltInTypeAlias

using System;
using Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements;

#if WINRT
using System.Collections.Generic;
using BindableProgressBarValue = Microsoft.Toolkit.Uwp.Notifications.AdaptiveProgressBarValue;
using BindableString = System.String;
#else
using BindableProgressBarValue = Microsoft.Toolkit.Uwp.Notifications.BindableProgressBarValue;
using BindableString = Microsoft.Toolkit.Uwp.Notifications.BindableString;
#endif
using System;
using Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements;

namespace Microsoft.Toolkit.Uwp.Notifications
{
Expand All @@ -25,46 +33,22 @@ public sealed class AdaptiveProgressBar : IToastBindingGenericChild
/// <summary>
/// Gets or sets an optional title string. Supports data binding.
/// </summary>
public
#if WINRT
string
#else
BindableString
#endif
Title { get; set; }
public BindableString Title { get; set; }

/// <summary>
/// Gets or sets the value of the progress bar. Supports data binding. Defaults to 0.
/// </summary>
public
#if WINRT
AdaptiveProgressBarValue
#else
BindableProgressBarValue
#endif
Value { get; set; } = AdaptiveProgressBarValue.FromValue(0);
public BindableProgressBarValue Value { get; set; } = AdaptiveProgressBarValue.FromValue(0);

/// <summary>
/// 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.
/// </summary>
public
#if WINRT
string
#else
BindableString
#endif
ValueStringOverride { get; set; }
public BindableString ValueStringOverride { get; set; }

/// <summary>
/// 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..."
/// </summary>
public
#if WINRT
string
#else
BindableString
#endif
Status { get; set; }
public BindableString Status { get; set; }

internal Element_AdaptiveProgressBar ConvertToElement()
{
Expand Down
17 changes: 9 additions & 8 deletions Microsoft.Toolkit.Uwp.Notifications/Adaptive/AdaptiveText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#pragma warning disable SA1121 // UseBuiltInTypeAlias

using System;
using Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements;

#if WINRT
using System.Collections.Generic;
using BindableString = System.String;
#else
using BindableString = Microsoft.Toolkit.Uwp.Notifications.BindableString;
#endif
using Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements;

namespace Microsoft.Toolkit.Uwp.Notifications
{
Expand All @@ -29,13 +36,7 @@ public sealed class AdaptiveText
/// Gets or sets the text to display. Data binding support added in Creators Update,
/// only works for toast top-level text elements.
/// </summary>
public
#if WINRT
string
#else
BindableString
#endif
Text { get; set; }
public BindableString Text { get; set; }

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

0 comments on commit a52ad35

Please sign in to comment.