protected async Task AddInitialSubscriptionsAsync() { using (_tasksService.LoadedProject()) { SubscribeToConfiguredProject(_activeConfiguredProjectSubscriptionService, new ActionBlock <IProjectVersionedValue <IProjectSubscriptionUpdate> >(e => OnProjectChangedAsync(e, RuleHandlerType.Evaluation))); foreach (var subscriber in Subscribers) { await subscriber.Value.InitializeSubscriberAsync(this, _activeConfiguredProjectSubscriptionService) .ConfigureAwait(false); } } }
private async Task AddSubscriptionsAsync(AggregateWorkspaceProjectContext newProjectContext) { Requires.NotNull(newProjectContext, nameof(newProjectContext)); await _commonServices.ThreadingService.SwitchToUIThread(); using (_tasksService.LoadedProject()) { var watchedEvaluationRules = GetWatchedRules(RuleHandlerType.Evaluation); var watchedDesignTimeBuildRules = GetWatchedRules(RuleHandlerType.DesignTimeBuild); foreach (var configuredProject in newProjectContext.InnerConfiguredProjects) { if (_projectConfigurationsWithSubscriptions.Contains(configuredProject.ProjectConfiguration)) { continue; } _designTimeBuildSubscriptionLinks.Add(configuredProject.Services.ProjectSubscription.JointRuleSource.SourceBlock.LinkTo( new ActionBlock <IProjectVersionedValue <IProjectSubscriptionUpdate> >(e => OnProjectChangedCoreAsync(e, RuleHandlerType.DesignTimeBuild)), ruleNames: watchedDesignTimeBuildRules.Union(watchedEvaluationRules), suppressVersionOnlyUpdates: true)); _evaluationSubscriptionLinks.Add(configuredProject.Services.ProjectSubscription.ProjectRuleSource.SourceBlock.LinkTo( new ActionBlock <IProjectVersionedValue <IProjectSubscriptionUpdate> >(e => OnProjectChangedCoreAsync(e, RuleHandlerType.Evaluation)), ruleNames: watchedEvaluationRules, suppressVersionOnlyUpdates: true)); _projectConfigurationsWithSubscriptions.Add(configuredProject.ProjectConfiguration); } } }
private Task OnProjectFactoryCompletedAsync() { using (_tasksService.LoadedProject()) { var watchedEvaluationRules = GetWatchedRules(RuleHandlerType.Evaluation); var watchedDesignTimeBuildRules = GetWatchedRules(RuleHandlerType.DesignTimeBuild); _designTimeBuildSubscriptionLinks.Add(_activeConfiguredProjectSubscriptionService.JointRuleSource.SourceBlock.LinkTo( new ActionBlock <IProjectVersionedValue <IProjectSubscriptionUpdate> >(e => OnProjectChangedAsync(e, RuleHandlerType.DesignTimeBuild)), ruleNames: watchedDesignTimeBuildRules.Union(watchedEvaluationRules), suppressVersionOnlyUpdates: true)); _evaluationSubscriptionLinks.Add(_activeConfiguredProjectSubscriptionService.ProjectRuleSource.SourceBlock.LinkTo( new ActionBlock <IProjectVersionedValue <IProjectSubscriptionUpdate> >(e => OnProjectChangedAsync(e, RuleHandlerType.Evaluation)), ruleNames: watchedEvaluationRules, suppressVersionOnlyUpdates: true)); } return(Task.CompletedTask); }