Skip to content

Commit 3587c40

Browse files
committed
SuggestionsRequested -> SuggestionRequested
1 parent 70c9ef0 commit 3587c40

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/RichSuggestBox/RichSuggestBoxPage.xaml.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,28 @@ public void OnXamlRendered(FrameworkElement control)
102102
if (this._rsb != null)
103103
{
104104
this._rsb.SuggestionChosen -= this.SuggestingBox_OnSuggestionChosen;
105-
this._rsb.SuggestionsRequested -= this.SuggestingBox_OnSuggestionsRequested;
105+
this._rsb.SuggestionRequested -= this.SuggestingBox_OnSuggestionRequested;
106106
}
107107

108108
if (this._tsb != null)
109109
{
110110
this._tsb.SuggestionChosen -= this.SuggestingBox_OnSuggestionChosen;
111-
this._tsb.SuggestionsRequested -= this.SuggestingBox_OnSuggestionsRequested;
111+
this._tsb.SuggestionRequested -= this.SuggestingBox_OnSuggestionRequested;
112112
this._tsb.TokenPointerOver -= this.SuggestingBox_OnTokenPointerOver;
113113
}
114114

115115
if (control.FindChild("SuggestingBox") is RichSuggestBox rsb)
116116
{
117117
this._rsb = rsb;
118118
this._rsb.SuggestionChosen += this.SuggestingBox_OnSuggestionChosen;
119-
this._rsb.SuggestionsRequested += this.SuggestingBox_OnSuggestionsRequested;
119+
this._rsb.SuggestionRequested += this.SuggestingBox_OnSuggestionRequested;
120120
}
121121

122122
if (control.FindChild("PlainTextSuggestingBox") is RichSuggestBox tsb)
123123
{
124124
this._tsb = tsb;
125125
this._tsb.SuggestionChosen += this.SuggestingBox_OnSuggestionChosen;
126-
this._tsb.SuggestionsRequested += this.SuggestingBox_OnSuggestionsRequested;
126+
this._tsb.SuggestionRequested += this.SuggestingBox_OnSuggestionRequested;
127127
this._tsb.TokenPointerOver += this.SuggestingBox_OnTokenPointerOver;
128128
}
129129

@@ -150,11 +150,11 @@ private void SuggestingBox_OnTokenPointerOver(RichSuggestBox sender, RichSuggest
150150
{
151151
cp.Content = args.Token.Item;
152152
flyout.ShowAt(sender, new FlyoutShowOptions
153-
{
154-
Position = pointerPosition,
155-
ExclusionRect = sender.GetRectFromRange(args.Range),
156-
ShowMode = FlyoutShowMode.TransientWithDismissOnPointerMoveAway,
157-
});
153+
{
154+
Position = pointerPosition,
155+
ExclusionRect = sender.GetRectFromRange(args.Range),
156+
ShowMode = FlyoutShowMode.TransientWithDismissOnPointerMoveAway,
157+
});
158158
});
159159
}
160160
}
@@ -175,7 +175,7 @@ private void SuggestingBox_OnSuggestionChosen(RichSuggestBox sender, SuggestionC
175175
}
176176
}
177177

178-
private void SuggestingBox_OnSuggestionsRequested(RichSuggestBox sender, SuggestionsRequestedEventArgs args)
178+
private void SuggestingBox_OnSuggestionRequested(RichSuggestBox sender, SuggestionRequestedEventArgs args)
179179
{
180180
if (args.Prefix == "#")
181181
{

Microsoft.Toolkit.Uwp.UI.Controls.Input/RichSuggestBox/RichSuggestBox.Events.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public partial class RichSuggestBox
1616
/// <summary>
1717
/// Event raised when the control needs to show suggestions.
1818
/// </summary>
19-
public event TypedEventHandler<RichSuggestBox, SuggestionsRequestedEventArgs> SuggestionsRequested;
19+
public event TypedEventHandler<RichSuggestBox, SuggestionRequestedEventArgs> SuggestionRequested;
2020

2121
/// <summary>
2222
/// Event raised when user click on a suggestion.

Microsoft.Toolkit.Uwp.UI.Controls.Input/RichSuggestBox/RichSuggestBox.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,13 +562,13 @@ private async Task RequestSuggestionsAsync(ITextRange range = null)
562562
CancellationTokenSource = tokenSource
563563
};
564564

565-
if (SuggestionsRequested != null)
565+
if (SuggestionRequested != null)
566566
{
567567
var cancellationToken = tokenSource.Token;
568-
var eventArgs = new SuggestionsRequestedEventArgs { QueryText = query, Prefix = prefix };
568+
var eventArgs = new SuggestionRequestedEventArgs { QueryText = query, Prefix = prefix };
569569
try
570570
{
571-
await SuggestionsRequested.InvokeAsync(this, eventArgs, cancellationToken);
571+
await SuggestionRequested.InvokeAsync(this, eventArgs, cancellationToken);
572572
}
573573
catch (OperationCanceledException)
574574
{

Microsoft.Toolkit.Uwp.UI.Controls.Input/RichSuggestBox/SuggestionsRequestedEventArgs.cs renamed to Microsoft.Toolkit.Uwp.UI.Controls.Input/RichSuggestBox/SuggestionRequestedEventArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
namespace Microsoft.Toolkit.Uwp.UI.Controls
88
{
99
/// <summary>
10-
/// Provide data for <see cref="RichSuggestBox.SuggestionsRequested"/> event.
10+
/// Provide data for <see cref="RichSuggestBox.SuggestionRequested"/> event.
1111
/// </summary>
12-
public class SuggestionsRequestedEventArgs : DeferredCancelEventArgs
12+
public class SuggestionRequestedEventArgs : DeferredCancelEventArgs
1313
{
1414
/// <summary>
1515
/// Gets or sets the prefix character used for the query.

UITests/UITests.Tests.Shared/Controls/RichSuggestBoxTestPage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<controls:RichSuggestBox x:Name="richSuggestBox"
1212
Width="300"
1313
AutomationProperties.Name="richSuggestBox"
14-
SuggestionChosen="RichSuggestBox_OnSuggestionsChosen"
15-
SuggestionsRequested="RichSuggestBox_OnSuggestionsRequested" />
14+
SuggestionChosen="RichSuggestBox_OnSuggestionChosen"
15+
SuggestionRequested="RichSuggestBox_OnSuggestionRequested" />
1616

1717
<TextBlock x:Name="tokenCounter"
1818
Text="{x:Bind richSuggestBox.Tokens.Count, Mode=OneWay}" />

UITests/UITests.Tests.Shared/Controls/RichSuggestBoxTestPage.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public RichSuggestBoxTestPage()
2020
this.InitializeComponent();
2121
}
2222

23-
private void RichSuggestBox_OnSuggestionsRequested(RichSuggestBox sender, SuggestionsRequestedEventArgs args)
23+
private void RichSuggestBox_OnSuggestionRequested(RichSuggestBox sender, SuggestionRequestedEventArgs args)
2424
{
2525
sender.ItemsSource = _suggestions;
2626
}
2727

28-
private void RichSuggestBox_OnSuggestionsChosen(RichSuggestBox sender, SuggestionChosenEventArgs args)
28+
private void RichSuggestBox_OnSuggestionChosen(RichSuggestBox sender, SuggestionChosenEventArgs args)
2929
{
3030
args.DisplayText = args.QueryText + (string)args.SelectedItem;
3131
}

UnitTests/UnitTests.UWP/UI/Controls/Test_RichSuggestBox.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,11 @@ private static async Task TestAddTokenAsync(RichSuggestBox rsb, string tokenText
325325
bool suggestionsRequestedCalled = false;
326326
bool suggestionChosenCalled = false;
327327

328-
void SuggestionsRequestedHandler(RichSuggestBox sender, SuggestionsRequestedEventArgs args)
328+
void SuggestionsRequestedHandler(RichSuggestBox sender, SuggestionRequestedEventArgs args)
329329
{
330330
suggestionsRequestedCalled = true;
331-
Assert.AreEqual(tokenText[0].ToString(), args.Prefix, $"Unexpected prefix in {nameof(RichSuggestBox.SuggestionsRequested)}.");
332-
Assert.AreEqual(tokenText.Substring(1), args.QueryText, $"Unexpected query in {nameof(RichSuggestBox.SuggestionsRequested)}.");
331+
Assert.AreEqual(tokenText[0].ToString(), args.Prefix, $"Unexpected prefix in {nameof(RichSuggestBox.SuggestionRequested)}.");
332+
Assert.AreEqual(tokenText.Substring(1), args.QueryText, $"Unexpected query in {nameof(RichSuggestBox.SuggestionRequested)}.");
333333
}
334334

335335
void SuggestionChosenHandler(RichSuggestBox sender, SuggestionChosenEventArgs args)
@@ -341,16 +341,16 @@ void SuggestionChosenHandler(RichSuggestBox sender, SuggestionChosenEventArgs ar
341341
Assert.AreSame(tokenText, args.SelectedItem, $"Selected item has unknown object {args.SelectedItem} in {nameof(RichSuggestBox.SuggestionChosen)}.");
342342
}
343343

344-
rsb.SuggestionsRequested += SuggestionsRequestedHandler;
344+
rsb.SuggestionRequested += SuggestionsRequestedHandler;
345345
rsb.SuggestionChosen += SuggestionChosenHandler;
346346

347347
await AddTokenAsync(rsb, tokenText);
348348

349-
rsb.SuggestionsRequested -= SuggestionsRequestedHandler;
349+
rsb.SuggestionRequested -= SuggestionsRequestedHandler;
350350
rsb.SuggestionChosen -= SuggestionChosenHandler;
351351

352-
Assert.IsTrue(suggestionsRequestedCalled, "SuggestionsRequested was not invoked.");
353-
Assert.IsTrue(suggestionChosenCalled, "SuggestionChosen was not invoked.");
352+
Assert.IsTrue(suggestionsRequestedCalled, $"{nameof(RichSuggestBox.SuggestionRequested)} was not invoked.");
353+
Assert.IsTrue(suggestionChosenCalled, $"{nameof(RichSuggestBox.SuggestionChosen)} was not invoked.");
354354
}
355355

356356
private static async Task AddTokenAsync(RichSuggestBox rsb, string tokenText)

0 commit comments

Comments
 (0)