public void Initialize(IBuildServerWatcher buildServerWatcher, ISettingsSource config, Func <ObjectId, bool> isCommitInRevisionGrid = null) { if (_buildServerWatcher != null) { throw new InvalidOperationException("Already initialized"); } _buildServerWatcher = buildServerWatcher; _settings = IntegrationSettings.ReadFrom(config); if (!_settings.IsValid()) { return; } _projectUrl = _buildServerWatcher.ReplaceVariables(_settings.ProjectUrl); if (!Uri.IsWellFormedUriString(_projectUrl, UriKind.Absolute) || string.IsNullOrWhiteSpace(_settings.ApiToken)) { return; } _apiClient = new ApiClient(_projectUrl, _settings.ApiToken); if (CacheAzureDevOps == null || CacheAzureDevOps.Id != CacheKey) { CacheAzureDevOps = null; _buildDefinitionsTask = _apiClient.GetBuildDefinitionsAsync(_settings.BuildDefinitionFilter); } else { _buildDefinitions = CacheAzureDevOps.BuildDefinitions; } }
public void Initialize(IBuildServerWatcher buildServerWatcher, ISettingsSource config, Func <ObjectId, bool> isCommitInRevisionGrid = null) { if (_buildServerWatcher != null) { throw new InvalidOperationException("Already initialized"); } _buildServerWatcher = buildServerWatcher; _settings = IntegrationSettings.ReadFrom(config); if (!_settings.IsValid()) { return; } var projectUrl = _buildServerWatcher.ReplaceVariables(_settings.ProjectUrl); _apiClient = new ApiClient(projectUrl, _settings.ApiToken); }