Пример #1
0
 IObservableX <IObservableServiceClient> CreateClientFor(ProcessSettings serviceHostProcessSettings)
 {
     return(ObservableX.CreateWithDisposable <IObservableServiceClient>(observer =>
     {
         try
         {
             var serviceHostUri = ServiceHostUriFor(serviceHostProcessSettings);
             observer.CompleteWith(new ObservableServiceClient(serviceHostUri));
         }
         catch (Exception e)
         {
             Logger.LogError(e);
             observer.OnError(e);
         }
         return Disposable.Empty;
     }));
 }
Пример #2
0
 IObservableX <TResult> SendAsync <TResponse, TResult>(object request, Action <TResponse, IObserverX <TResult>, MultipleAssignmentDisposable> onSuccess)
 {
     return(ObservableX.CreateWithDisposable <TResult>(observer =>
     {
         var client = NewJsonServiceClient();
         var disposable = MultipleAssignmentDisposableFor(client);
         client.SendAsync <TResponse>(
             request,
             onSuccess: response => onSuccess(response, observer, disposable),
             onError: (response, exception) =>
         {
             disposable.Disposable = null;
             observer.OnError(exception);
         });
         return disposable;
     }));
 }