internal BaseOperator(string hostname, IHostProperties hostProperties, INetworkOperationStatusListener networkOperationStatusListener) { _settings = hostProperties; Hostname = hostname; _client = new GitLabTaskRunner(hostname, _settings.GetAccessToken(hostname)); _networkOperationStatusListener = networkOperationStatusListener; }
async public Task Connect(GitLabInstance gitLabInstance, DataCacheConnectionContext connectionContext) { assertNotConnected(); string hostname = gitLabInstance.HostName; IHostProperties hostProperties = gitLabInstance.HostProperties; _operator = new DataCacheOperator(hostname, hostProperties, gitLabInstance.NetworkOperationStatusListener); DataCacheOperator myOperator = _operator; _isConnecting = true; try { Connecting?.Invoke(hostname); InternalCacheUpdater cacheUpdater = new InternalCacheUpdater(new InternalCache()); bool isApprovalStatusSupported = await gitLabInstance.IsApprovalStatusSupported(); IMergeRequestListLoader mergeRequestListLoader = new MergeRequestListLoader( hostname, _operator, cacheUpdater, _cacheContext.Callbacks, connectionContext.QueryCollection, isApprovalStatusSupported); traceInformation(String.Format("Connecting data cache to {0}...", hostname)); string accessToken = hostProperties.GetAccessToken(hostname); await new CurrentUserLoader(_operator).Load(hostname, accessToken); User currentUser = GlobalCache.GetAuthenticatedUser(hostname, accessToken); await mergeRequestListLoader.Load(); _internal = createCacheInternal(cacheUpdater, hostname, hostProperties, currentUser, connectionContext.QueryCollection, gitLabInstance.ModificationNotifier, gitLabInstance.NetworkOperationStatusListener, isApprovalStatusSupported); ConnectionContext = connectionContext; traceInformation(String.Format("Data cache connected to {0}", hostname)); Connected?.Invoke(hostname, currentUser); } catch (BaseLoaderException ex) { reset(); if (ex is BaseLoaderCancelledException) { throw new DataCacheConnectionCancelledException(); } throw new DataCacheException(ex.OriginalMessage, ex); } finally { _isConnecting = false; } }
internal BaseOperator(string hostname, IHostProperties hostProperties) { _settings = hostProperties; Hostname = hostname; _client = new GitLabTaskRunner(hostname, _settings.GetAccessToken(hostname)); }