From d55bdd19a4fe412a19b5f474b0dd07da7aab14c4 Mon Sep 17 00:00:00 2001 From: Vincent Date: Fri, 20 Mar 2020 16:14:46 +0100 Subject: [PATCH] restore task return value + add discards --- .../BluetoothLEHelper/ObservableGattDeviceService.cs | 7 +++++-- Microsoft.Toolkit.Uwp.SampleApp/Shell.SamplePicker.cs | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper/ObservableGattDeviceService.cs b/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper/ObservableGattDeviceService.cs index 6ee1e3e89d7..7ddd6543090 100644 --- a/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper/ObservableGattDeviceService.cs +++ b/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper/ObservableGattDeviceService.cs @@ -48,7 +48,7 @@ public ObservableGattDeviceService(GattDeviceService service) Service = service; Name = GattUuidsService.ConvertUuidToName(service.Uuid); UUID = Service.Uuid.ToString(); - PopulateAllCharacteristicsAsync(); + _ = PopulateAllCharacteristicsAsync(); } /// @@ -149,7 +149,8 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName /// /// Populate the characteristics in . /// - private async void PopulateAllCharacteristicsAsync() + /// The status of the communication with the GATT device. + private async Task PopulateAllCharacteristicsAsync() { var tokenSource = new CancellationTokenSource(5000); var getCharacteristicsTask = await Task.Run( @@ -166,6 +167,8 @@ private async void PopulateAllCharacteristicsAsync() Characteristics.Add(new ObservableGattCharacteristics(gattCharacteristic, this)); } } + + return result.Status; } } } \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Shell.SamplePicker.cs b/Microsoft.Toolkit.Uwp.SampleApp/Shell.SamplePicker.cs index 2693248f5d4..936e8fffb82 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Shell.SamplePicker.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/Shell.SamplePicker.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; +using System.Threading.Tasks; using Microsoft.Toolkit.Uwp.SampleApp.Pages; using Microsoft.Toolkit.Uwp.UI.Animations; using Microsoft.Toolkit.Uwp.UI.Controls; @@ -35,11 +36,11 @@ private Sample CurrentSample set { _currentSample = value; - SetNavViewSelection(); + _ = SetNavViewSelectionAsync(); } } - private async void SetNavViewSelection() + private async Task SetNavViewSelectionAsync() { if (_currentSample != null) { @@ -61,7 +62,7 @@ private void HideSamplePicker() SamplePickerGrid.Visibility = Visibility.Collapsed; _selectedCategory = null; - SetNavViewSelection(); + _ = SetNavViewSelectionAsync(); } private async void ShowSamplePicker(Sample[] samples = null, bool group = false)