示例#1
0
        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));
            }
        }
示例#2
0
        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);
        }