Skip to content

Commit

Permalink
restore task return value + add discards
Browse files Browse the repository at this point in the history
  • Loading branch information
vgromfeld committed Mar 20, 2020
1 parent 1cbcf90 commit d55bdd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ObservableGattDeviceService(GattDeviceService service)
Service = service;
Name = GattUuidsService.ConvertUuidToName(service.Uuid);
UUID = Service.Uuid.ToString();
PopulateAllCharacteristicsAsync();
_ = PopulateAllCharacteristicsAsync();
}

/// <summary>
Expand Down Expand Up @@ -149,7 +149,8 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName
/// <summary>
/// Populate the characteristics in <see cref="Characteristics"/>.
/// </summary>
private async void PopulateAllCharacteristicsAsync()
/// <returns>The status of the communication with the GATT device.</returns>
private async Task<GattCommunicationStatus> PopulateAllCharacteristicsAsync()
{
var tokenSource = new CancellationTokenSource(5000);
var getCharacteristicsTask = await Task.Run(
Expand All @@ -166,6 +167,8 @@ private async void PopulateAllCharacteristicsAsync()
Characteristics.Add(new ObservableGattCharacteristics(gattCharacteristic, this));
}
}

return result.Status;
}
}
}
7 changes: 4 additions & 3 deletions Microsoft.Toolkit.Uwp.SampleApp/Shell.SamplePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -35,11 +36,11 @@ private Sample CurrentSample
set
{
_currentSample = value;
SetNavViewSelection();
_ = SetNavViewSelectionAsync();
}
}

private async void SetNavViewSelection()
private async Task SetNavViewSelectionAsync()
{
if (_currentSample != null)
{
Expand All @@ -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)
Expand Down

0 comments on commit d55bdd1

Please sign in to comment.