Skip to content

Commit 6e824cd

Browse files
committed
Remove all 'WINRT' specific code
1 parent add7f5e commit 6e824cd

19 files changed

+15
-495
lines changed

components/Notifications/src/Adaptive/AdaptiveProgressBar.cs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,8 @@
66

77
using System;
88
using CommunityToolkit.Notifications.Adaptive.Elements;
9-
10-
#if WINRT
11-
using System.Collections.Generic;
12-
using BindableProgressBarValue = CommunityToolkit.Notifications.AdaptiveProgressBarValue;
13-
using BindableString = System.String;
14-
#else
159
using BindableProgressBarValue = CommunityToolkit.Notifications.BindableProgressBarValue;
1610
using BindableString = CommunityToolkit.Notifications.BindableString;
17-
#endif
1811

1912
namespace CommunityToolkit.Notifications
2013
{
@@ -23,13 +16,6 @@ namespace CommunityToolkit.Notifications
2316
/// </summary>
2417
public sealed class AdaptiveProgressBar : IToastBindingGenericChild
2518
{
26-
#if WINRT
27-
/// <summary>
28-
/// Gets a dictionary of the current data bindings, where you can assign new bindings.
29-
/// </summary>
30-
public IDictionary<AdaptiveProgressBarBindableProperty, string> Bindings { get; private set; } = new Dictionary<AdaptiveProgressBarBindableProperty, string>();
31-
#endif
32-
3319
/// <summary>
3420
/// Gets or sets an optional title string. Supports data binding.
3521
/// </summary>
@@ -61,17 +47,10 @@ internal Element_AdaptiveProgressBar ConvertToElement()
6147

6248
var answer = new Element_AdaptiveProgressBar();
6349

64-
#if WINRT
65-
answer.Title = XmlWriterHelper.GetBindingOrAbsoluteXmlValue(Bindings, AdaptiveProgressBarBindableProperty.Title, Title);
66-
answer.Value = XmlWriterHelper.GetBindingOrAbsoluteXmlValue(Bindings, AdaptiveProgressBarBindableProperty.Value, val.ToXmlString());
67-
answer.ValueStringOverride = XmlWriterHelper.GetBindingOrAbsoluteXmlValue(Bindings, AdaptiveProgressBarBindableProperty.ValueStringOverride, ValueStringOverride);
68-
answer.Status = XmlWriterHelper.GetBindingOrAbsoluteXmlValue(Bindings, AdaptiveProgressBarBindableProperty.Status, Status);
69-
#else
7050
answer.Title = Title?.ToXmlString();
7151
answer.Value = val.ToXmlString();
7252
answer.ValueStringOverride = ValueStringOverride?.ToXmlString();
7353
answer.Status = Status?.ToXmlString();
74-
#endif
7554

7655
if (answer.Status == null)
7756
{
@@ -81,4 +60,4 @@ internal Element_AdaptiveProgressBar ConvertToElement()
8160
return answer;
8261
}
8362
}
84-
}
63+
}

components/Notifications/src/Adaptive/AdaptiveProgressBarBindableProperty.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

components/Notifications/src/Adaptive/AdaptiveText.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@
66

77
using System;
88
using CommunityToolkit.Notifications.Adaptive.Elements;
9-
10-
#if WINRT
11-
using System.Collections.Generic;
12-
using BindableString = System.String;
13-
#else
149
using BindableString = CommunityToolkit.Notifications.BindableString;
15-
#endif
1610

1711
namespace CommunityToolkit.Notifications
1812
{
@@ -25,13 +19,6 @@ public sealed class AdaptiveText
2519
ITileBindingContentAdaptiveChild,
2620
IToastBindingGenericChild
2721
{
28-
#if WINRT
29-
/// <summary>
30-
/// Gets a dictionary of the current data bindings, where you can assign new bindings.
31-
/// </summary>
32-
public IDictionary<AdaptiveTextBindableProperty, string> Bindings { get; private set; } = new Dictionary<AdaptiveTextBindableProperty, string>();
33-
#endif
34-
3522
/// <summary>
3623
/// Gets or sets the text to display. Data binding support added in Creators Update,
3724
/// only works for toast top-level text elements.
@@ -129,11 +116,7 @@ internal Element_AdaptiveText ConvertToElement()
129116
Align = HintAlign
130117
};
131118

132-
#if WINRT
133-
answer.Text = XmlWriterHelper.GetBindingOrAbsoluteXmlValue(Bindings, AdaptiveTextBindableProperty.Text, Text);
134-
#else
135119
answer.Text = Text?.ToXmlString();
136-
#endif
137120

138121
return answer;
139122
}
@@ -147,4 +130,4 @@ public override string ToString()
147130
return Text;
148131
}
149132
}
150-
}
133+
}

components/Notifications/src/Adaptive/AdaptiveTextBindableProperty.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

components/Notifications/src/Adaptive/BindableValues/BindableProgressBarValue.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
namespace CommunityToolkit.Notifications
66
{
7-
// Note that this code is NOT compiled for WinRT.
8-
// WinRT uses a different binding system since it doesn't support implicit type converters.
9-
#if !WINRT
107
/// <summary>
118
/// A binding value for doubles.
129
/// </summary>
@@ -88,5 +85,4 @@ public static implicit operator BindableProgressBarValue(double d)
8885
return AdaptiveProgressBarValue.FromValue(d);
8986
}
9087
}
91-
#endif
92-
}
88+
}

components/Notifications/src/Adaptive/BindableValues/BindableString.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
namespace CommunityToolkit.Notifications
66
{
7-
// Note that this code is NOT compiled for WinRT.
8-
// WinRT uses a different binding system since it doesn't support implicit type converters.
9-
#if !WINRT
107
/// <summary>
118
/// A binding value for strings.
129
/// </summary>
@@ -68,5 +65,4 @@ public static implicit operator string(BindableString b)
6865
return b.RawValue;
6966
}
7067
}
71-
#endif
72-
}
68+
}

components/Notifications/src/Tiles/Builder/TileContentBuilder.SpecialTiles.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace CommunityToolkit.Notifications
1111
{
12-
#if !WINRT
1312
#pragma warning disable SA1008
1413
#pragma warning disable SA1009
1514
/// <summary>
@@ -159,5 +158,4 @@ private static TileBasicImage CreateTileBasicImage(Uri imageUri, string imageAlt
159158
}
160159
#pragma warning restore SA1008
161160
#pragma warning restore SA1009
162-
#endif
163-
}
161+
}

components/Notifications/src/Tiles/Builder/TileContentBuilder.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
namespace CommunityToolkit.Notifications
88
{
9-
#if !WINRT
10-
119
/// <summary>
1210
/// Builder class used to create <see cref="TileContent"/>
1311
/// </summary>
@@ -526,6 +524,4 @@ private TileBindingContentAdaptive GetAdaptiveTileContent(TileBinding binding)
526524
return binding.Content as TileBindingContentAdaptive;
527525
}
528526
}
529-
530-
#endif
531-
}
527+
}

components/Notifications/src/Toasts/Builder/ToastContentBuilder.Actions.cs

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ namespace CommunityToolkit.Notifications
1313
/// <summary>
1414
/// Builder class used to create <see cref="ToastContent"/>
1515
/// </summary>
16-
public
17-
#if WINRT
18-
sealed
19-
#endif
20-
partial class ToastContentBuilder
16+
public partial class ToastContentBuilder
2117
{
2218
private IToastActions Actions
2319
{
@@ -86,9 +82,6 @@ public ToastContentBuilder AddButton(string content, ToastActivationType activat
8682
/// <param name="arguments">App-defined string of arguments that the app can later retrieve once it is activated when the user clicks the button.</param>
8783
/// <param name="imageUri">Optional image icon for the button to display (required for buttons adjacent to inputs like quick reply).</param>
8884
/// <returns>The current instance of <see cref="ToastContentBuilder"/></returns>
89-
#if WINRT
90-
[Windows.Foundation.Metadata.DefaultOverload]
91-
#endif
9285
public ToastContentBuilder AddButton(string content, ToastActivationType activationType, string arguments, Uri imageUri)
9386
{
9487
// Add new button
@@ -178,29 +171,6 @@ public ToastContentBuilder AddButton(string textBoxId, string content, ToastActi
178171
return AddButton(button);
179172
}
180173

181-
#if WINRT
182-
/// <summary>
183-
/// Add an input text box that the user can type into.
184-
/// </summary>
185-
/// <param name="id">Required ID property so that developers can retrieve user input once the app is activated.</param>
186-
/// <returns>The current instance of <see cref="ToastContentBuilder"/></returns>
187-
public ToastContentBuilder AddInputTextBox(string id)
188-
{
189-
return AddInputTextBox(id, default, default);
190-
}
191-
192-
/// <summary>
193-
/// Add an input text box that the user can type into.
194-
/// </summary>
195-
/// <param name="id">Required ID property so that developers can retrieve user input once the app is activated.</param>
196-
/// <param name="placeHolderContent">Placeholder text to be displayed on the text box when the user hasn't typed any text yet.</param>
197-
/// <returns>The current instance of <see cref="ToastContentBuilder"/></returns>
198-
public ToastContentBuilder AddInputTextBox(string id, string placeHolderContent)
199-
{
200-
return AddInputTextBox(id, placeHolderContent, default);
201-
}
202-
#endif
203-
204174
/// <summary>
205175
/// Add an input text box that the user can type into.
206176
/// </summary>
@@ -210,13 +180,8 @@ public ToastContentBuilder AddInputTextBox(string id, string placeHolderContent)
210180
/// <returns>The current instance of <see cref="ToastContentBuilder"/></returns>
211181
public ToastContentBuilder AddInputTextBox(
212182
string id,
213-
#if WINRT
214-
string placeHolderContent,
215-
string title)
216-
#else
217183
string placeHolderContent = default,
218184
string title = default)
219-
#endif
220185
{
221186
var inputTextBox = new ToastTextBox(id);
222187

@@ -233,7 +198,6 @@ public ToastContentBuilder AddInputTextBox(
233198
return AddToastInput(inputTextBox);
234199
}
235200

236-
#if !WINRT
237201
/// <summary>
238202
/// Add a combo box / drop-down menu that contain options for user to select.
239203
/// </summary>
@@ -300,7 +264,6 @@ public ToastContentBuilder AddComboBox(string id, string title, string defaultSe
300264

301265
return AddToastInput(box);
302266
}
303-
#endif
304267

305268
/// <summary>
306269
/// Add an input option to the Toast.
@@ -316,4 +279,4 @@ public ToastContentBuilder AddToastInput(IToastInput input)
316279
}
317280
#pragma warning restore SA1008
318281
#pragma warning restore SA1009
319-
}
282+
}

0 commit comments

Comments
 (0)