Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

36 lignes
1.2 KiB

  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Threading.Tasks;
  6. namespace MQTTnet.Extensions.ManagedClient
  7. {
  8. public class SynchronizingSubscriptionsFailedHandlerDelegate : ISynchronizingSubscriptionsFailedHandler
  9. {
  10. private readonly Func<ManagedProcessFailedEventArgs, Task> _handler;
  11. public SynchronizingSubscriptionsFailedHandlerDelegate(Action<ManagedProcessFailedEventArgs> handler)
  12. {
  13. if (handler == null) throw new ArgumentNullException(nameof(handler));
  14. _handler = context =>
  15. {
  16. handler(context);
  17. return Task.FromResult(0);
  18. };
  19. }
  20. public SynchronizingSubscriptionsFailedHandlerDelegate(Func<ManagedProcessFailedEventArgs, Task> handler)
  21. {
  22. _handler = handler ?? throw new ArgumentNullException(nameof(handler));
  23. }
  24. public Task HandleSynchronizingSubscriptionsFailedAsync(ManagedProcessFailedEventArgs eventArgs)
  25. {
  26. return _handler(eventArgs);
  27. }
  28. }
  29. }