public virtual IHttpServiceClient GetHttpServiceClient() { var result = this._ServiceClient; if (result == null) { lock (this) { result = this._ServiceClient; if (result == null) { var baseUri = new Uri(this.ConnectionString.GetUrlNormalized()); #warning TODO ServiceClientCredentialsFactory ServiceClientCredentials credentials = new SharePointOnlineServiceClientCredentials(this.ConnectionString, null); result = new ODataServiceClient(baseUri, credentials, null); this._ServiceClient = result; } } } return(result); }
public BackplaneServiceClient(IUrlProvider urlProvider, IHttpServiceClient httpServiceClient) { _urlProvider = urlProvider; _httpServiceClient = httpServiceClient; _hubConnection = new HubConnection(_urlProvider.BackplaneUrl, true); _hubProxy = _hubConnection.CreateHubProxy("BroadcastHub"); ConnectionStateStream = Observable.Create <ConnectionState>(observer => { observer.OnNext(ConnectionState.Disconnected); return(Observable.FromEvent <StateChange>( h => _hubConnection.StateChanged += h, h => _hubConnection.StateChanged -= h) .Subscribe(s => observer.OnNext(s.NewState))); }); TokenAvailabilityStream = Observable.Create <bool>(observer => _hubProxy.On <bool>("OnTokenAvailability", observer.OnNext)) .DistinctUntilChanged(); }