iasyncoperation

IAsyncOperation<IReadOnlyList<UserNotification>>' does not contain a definition for 'GetAwaiter' [duplicate]

不想你离开。 提交于 2020-05-15 05:19:04
问题 This question already has answers here : FromBluetoothAddressAsync IAsyncOperation does not contain a definition for 'GetAwaiter' error (2 answers) Closed last year . I am using Visual Studio 2017 Professional. I have been following this guide: https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/notification-listener My problem code is as follows: using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System

Awaiting an IAsyncOperation in F#

血红的双手。 提交于 2019-12-11 08:42:10
问题 I have the following code in F#: let CreateSampleDataFromJson<'T>(path) = let uri = new Uri(path) async { let file = StorageFile.GetFileFromApplicationUriAsync(uri) let jsonText = FileIO.ReadTextAsync(file) return JsonObject<'T>.Parse(jsonText) } The problem I'm having is that file is an IAsyncOperation<StorageFile> and not a StorageFile as ReadTextAsync expects. In C# you can do something similar to this: var file = await StorageFile.GetFileFromApplicationUriAsync(uri) i.e. public async Task

How to stop a call resulting in IAsyncOperation?

落爺英雄遲暮 提交于 2019-12-08 07:28:48
问题 In my application I notify multiple devices. If a device is not reachable and is not responding within a few seconds, i want to cancel the call. My code is: await characteristic0.WriteClientCharacteristicConfigurationDescriptorAsync (GattClientCharacteristicConfigurationDescriptorValue.Notify); Now after some research i found out that usually one can pass a CancelationToken (_ct) and do this: First create an operation containing the call: IAsyncOperation<GattCommunicationStatus> operation =