示例#1
0
 public static void CancelRequest(this IResponseRouter mediator, long id)
 {
     mediator.SendNotification(JsonRpcNames.CancelRequest, new CancelParams()
     {
         Id = id
     });
 }
示例#2
0
 public static void CancelRequest(this IResponseRouter mediator, string id)
 {
     mediator.SendNotification(GeneralNames.CancelRequest, new CancelParams()
     {
         Id = id
     });
 }
        public void OnCompleted()
        {
            if (_disposable.IsDisposed)
            {
                return;
            }
            var @event = _onComplete?.Invoke() ?? new ProgressEndEvent {
                Message = "", ProgressId = ProgressId
            };

            if (EqualityComparer <ProgressToken> .Default.Equals(@event.ProgressId, default))
            {
                @event.ProgressId = ProgressId;
            }

            _router.SendNotification(@event);
        }
示例#4
0
        public void OnCompleted()
        {
            if (_disposable.IsDisposed)
            {
                return;
            }
            var @event = _onComplete?.Invoke() ?? new ProgressEndEvent {
                Message = "", ProgressId = ProgressId
            };

            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (@event.ProgressId is null)
            {
                @event = @event with {
                    ProgressId = ProgressId
                };
            }

            _router.SendNotification(@event);
        }

        void IObserver <ProgressUpdateEvent> .OnError(Exception error)
        {
            if (_disposable.IsDisposed)
            {
                return;
            }
            var @event = _onError?.Invoke(error) ?? new ProgressEndEvent {
                Message = error.ToString(), ProgressId = ProgressId
            };

            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (@event.ProgressId is null)
            {
                @event = @event with {
                    ProgressId = ProgressId
                };
            }

            _router.SendNotification(@event);
        }
示例#5
0
 public void OnNext(T value)
 {
     if (_isComplete)
     {
         return;
     }
     _responseRouter.SendNotification(new ProgressParams()
     {
         Token = ProgressToken,
         Value = JToken.FromObject(value, _serializer.JsonSerializer)
     });
 }
 public ProgressObserver(
     IResponseRouter router,
     ProgressStartEvent begin,
     Func <Exception, ProgressEndEvent> onError,
     Func <ProgressEndEvent> onComplete,
     CancellationToken cancellationToken
     )
 {
     ProgressId  = begin.ProgressId;
     _router     = router;
     _onError    = onError;
     _onComplete = onComplete;
     _disposable = new CompositeDisposable {
         Disposable.Create(OnCompleted)
     };
     cancellationToken.Register(Dispose);
     _router.SendNotification(begin);
 }
 public static void SendTelemetry(this IResponseRouter mediator, object @params)
 {
     mediator.SendNotification(TelemetryEvent, @params);
 }
示例#8
0
 public static void CancelRequest(this IResponseRouter mediator, string id) => mediator.SendNotification(new CancelParams {
     Id = id
 });
示例#9
0
 public static void CancelRequest(this IResponseRouter mediator, CancelParams @params) => mediator.SendNotification(@params);
 public void SendNotification(string method) => _responseRouter.SendNotification(method);
示例#11
0
 public static void ShowMessage(this IResponseRouter mediator, ShowMessageParams @params)
 {
     mediator.SendNotification(WindowNames.ShowMessage, @params);
 }
示例#12
0
 public static void CancelRequest(this IResponseRouter mediator, CancelParams @params)
 {
     mediator.SendNotification(JsonRpcNames.CancelRequest, @params);
 }
示例#13
0
 public static void SendProgress <T>(this IResponseRouter mediator, ProgressToken token, T value,
                                     JsonSerializer jsonSerializer)
 {
     mediator.SendNotification(ProgressParams.Create <T>(token, value, jsonSerializer));
 }
示例#14
0
 public static void SendProgress(this IResponseRouter mediator, ProgressParams @params)
 {
     mediator.SendNotification(@params);
 }
 public void OnCompleted() => _router.SendNotification(
     _progressToken.Create(_onComplete?.Invoke() ?? new WorkDoneProgressEnd()
 {
     Message = ""
 }, _serializer.JsonSerializer)
     );
 public static void PublishDiagnostics(this IResponseRouter mediator, PublishDiagnosticsParams @params)
 {
     mediator.SendNotification(DocumentNames.PublishDiagnostics, @params);
 }