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,

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top