Frage

I have a WP app that use NotificationHub.

To register the user, I call RegisterNativeAsync.

However, some users having slow connection raise to me that the loading is very long.

Is it possible to pass a CancellationToken when calling RegisterNativeAsync ?

Thanks,

War es hilfreich?

Lösung

The method RegisterNativeAsync doesn't directly support a cancellation token itself but if you want to add a timeout you could do this by having another task which creates a timeout and using Task.WhenAny to simulate this.

As this is an awaitable method there should be no need for this to be causing any kind of delay for the user.
Perhaps you need to look at the UX around this call.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top