public Task Subscribe(Action <string> callback, PrinterNotificationTypes notificationType, Guid correlationId = default) { _channel = GetChannel(notificationType, correlationId); _callback = callback; return(Task.CompletedTask); }
public Task Notify(string message, PrinterNotificationTypes notificationType, Guid correlationId = default) { var channel = GetChannel(notificationType, correlationId); if (channel.Equals(_channel)) { _callback(message); } return(Task.CompletedTask); }
public Task Subscribe(Action <string> callback, PrinterNotificationTypes notificationType, Guid correlationId = default) => Task.CompletedTask;
public Task Notify(string message, PrinterNotificationTypes notificationType, Guid correlationId = default) => Task.CompletedTask;
async Task IPrinterNotifier.Subscribe(Action <string> callback, PrinterNotificationTypes notificationType, Guid correlationId) { var channel = correlationId == Guid.Empty ? $"Printer.{notificationType.ToString()}" : $"Printer.{notificationType.ToString()}.{correlationId}"; await Subscribe(callback, channel); }
async Task IPrinterNotifier.Notify(string message, PrinterNotificationTypes notificationType, Guid correlationId) { var channel = correlationId == Guid.Empty ? $"Printer.{notificationType.ToString()}" : $"Printer.{notificationType.ToString()}.{correlationId}"; await Notify(message, channel); }
private string GetChannel(PrinterNotificationTypes nt, Guid correlationId) => correlationId == Guid.Empty ? $"FakePrinter.{nt}" : $"FakePrinter.{nt}.{correlationId}";