Skip to content

Commit d55bdd1

Browse files
committed
restore task return value + add discards
1 parent 1cbcf90 commit d55bdd1

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper/ObservableGattDeviceService.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public ObservableGattDeviceService(GattDeviceService service)
4848
Service = service;
4949
Name = GattUuidsService.ConvertUuidToName(service.Uuid);
5050
UUID = Service.Uuid.ToString();
51-
PopulateAllCharacteristicsAsync();
51+
_ = PopulateAllCharacteristicsAsync();
5252
}
5353

5454
/// <summary>
@@ -149,7 +149,8 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName
149149
/// <summary>
150150
/// Populate the characteristics in <see cref="Characteristics"/>.
151151
/// </summary>
152-
private async void PopulateAllCharacteristicsAsync()
152+
/// <returns>The status of the communication with the GATT device.</returns>
153+
private async Task<GattCommunicationStatus> PopulateAllCharacteristicsAsync()
153154
{
154155
var tokenSource = new CancellationTokenSource(5000);
155156
var getCharacteristicsTask = await Task.Run(
@@ -166,6 +167,8 @@ private async void PopulateAllCharacteristicsAsync()
166167
Characteristics.Add(new ObservableGattCharacteristics(gattCharacteristic, this));
167168
}
168169
}
170+
171+
return result.Status;
169172
}
170173
}
171174
}

Microsoft.Toolkit.Uwp.SampleApp/Shell.SamplePicker.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Collections.Generic;
77
using System.Linq;
88
using System.Numerics;
9+
using System.Threading.Tasks;
910
using Microsoft.Toolkit.Uwp.SampleApp.Pages;
1011
using Microsoft.Toolkit.Uwp.UI.Animations;
1112
using Microsoft.Toolkit.Uwp.UI.Controls;
@@ -35,11 +36,11 @@ private Sample CurrentSample
3536
set
3637
{
3738
_currentSample = value;
38-
SetNavViewSelection();
39+
_ = SetNavViewSelectionAsync();
3940
}
4041
}
4142

42-
private async void SetNavViewSelection()
43+
private async Task SetNavViewSelectionAsync()
4344
{
4445
if (_currentSample != null)
4546
{
@@ -61,7 +62,7 @@ private void HideSamplePicker()
6162
SamplePickerGrid.Visibility = Visibility.Collapsed;
6263
_selectedCategory = null;
6364

64-
SetNavViewSelection();
65+
_ = SetNavViewSelectionAsync();
6566
}
6667

6768
private async void ShowSamplePicker(Sample[] samples = null, bool group = false)

0 commit comments

Comments
 (0)