private void AsyncCallback(object Sender, ItemResultEventArgs e) { TaskCompletionSource <string> Result = (TaskCompletionSource <string>)e.State; if (e.Ok) { Result.TrySetResult(e.ItemId); } else { Result.TrySetException(new Exception(string.IsNullOrEmpty(e.ErrorText) ? "Unable to publish event." : e.ErrorText)); } }
private Task AsyncCallback(object Sender, ItemResultEventArgs e) { TaskCompletionSource <string> Result = (TaskCompletionSource <string>)e.State; if (e.Ok) { Result.TrySetResult(e.ItemId); } else { Result.TrySetException(e.StanzaError ?? new Exception("Unable to publish event.")); } return(Task.CompletedTask); }