public PullRequestFileMargin( IWpfTextView textView, IToggleInlineCommentMarginCommand toggleInlineCommentMarginCommand, IGoToSolutionOrPullRequestFileCommand goToSolutionOrPullRequestFileCommand, IPullRequestSessionManager sessionManager, Lazy <IUsageTracker> usageTracker) { this.textView = textView; this.sessionManager = sessionManager; viewModel = new PullRequestFileMarginViewModel(toggleInlineCommentMarginCommand, goToSolutionOrPullRequestFileCommand, usageTracker); visualElement = new PullRequestFileMarginView { DataContext = viewModel, ClipToBounds = true }; visibilitySubscription = viewModel.WhenAnyValue(x => x.Enabled).Subscribe(enabled => { visualElement.Visibility = enabled ? Visibility.Visible : Visibility.Collapsed; }); optionChangedSubscription = Observable.FromEventPattern(textView.Options, nameof(textView.Options.OptionChanged)).Subscribe(_ => { viewModel.MarginEnabled = textView.Options.GetOptionValue(InlineCommentTextViewOptions.MarginEnabledId); }); currentSessionSubscription = sessionManager.WhenAnyValue(x => x.CurrentSession) .Subscribe(x => RefreshCurrentSession().Forget()); }
public PullRequestFileMarginProvider( IToggleInlineCommentMarginCommand enableInlineCommentsCommand, IGoToSolutionOrPullRequestFileCommand goToSolutionOrPullRequestFileCommand, IPullRequestSessionManager sessionManager, IPackageSettings packageSettings, Lazy <IUsageTracker> usageTracker) { this.enableInlineCommentsCommand = enableInlineCommentsCommand; this.goToSolutionOrPullRequestFileCommand = goToSolutionOrPullRequestFileCommand; this.sessionManager = sessionManager; this.packageSettings = packageSettings; this.usageTracker = usageTracker; }