public override async void Execute() { processing = true; try { var tagSourceInstance = TagPluginsHelper.GetTagSourceInstances( _tagSourceService.GetTagSourceInstances(), ClientPlugin.Id) .First(); var azureDevOpsSettings = (AzureDevOpsWorkItemTagSettings)tagSourceInstance.Settings ?? new AzureDevOpsWorkItemTagSettings(); int days = int.Parse(azureDevOpsSettings.Days); var exporter = new TagsExporter( organizationName: azureDevOpsSettings.Organization, timeTrackerToken: azureDevOpsSettings.TimeTrackerApiSecret, billableActivityId: azureDevOpsSettings.BillableActivityId, nonBillableActivityId: azureDevOpsSettings.NonBillableActivityId, days: days); DateRange range = TagsExporter.GetDateRange(days); var tagActivities = await GetTagActivitiesAsync(range.From, range.To).ConfigureAwait(false); await exporter.Export(tagActivities, range); } catch (Exception ex) { ApplicationLog.WriteError(ex); } processing = false; if (changesQueued) { changesQueued = false; Execute(); } }
private void SetCanExecute() { CanExecute = TagPluginsHelper.GetTagSourceInstances(_tagSourceService.GetTagSourceInstances(), ClientPlugin.Id).Any(); }