예제 #1
0
        public PullRequestEditorService(
            IGitHubServiceProvider serviceProvider,
            IPullRequestService pullRequestService,
            IVsEditorAdaptersFactoryService vsEditorAdaptersFactory,
            IStatusBarNotificationService statusBar,
            IGoToSolutionOrPullRequestFileCommand goToSolutionOrPullRequestFileCommand,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            IUsageTracker usageTracker)
        {
            Guard.ArgumentNotNull(serviceProvider, nameof(serviceProvider));
            Guard.ArgumentNotNull(pullRequestService, nameof(pullRequestService));
            Guard.ArgumentNotNull(vsEditorAdaptersFactory, nameof(vsEditorAdaptersFactory));
            Guard.ArgumentNotNull(statusBar, nameof(statusBar));
            Guard.ArgumentNotNull(goToSolutionOrPullRequestFileCommand, nameof(goToSolutionOrPullRequestFileCommand));
            Guard.ArgumentNotNull(goToSolutionOrPullRequestFileCommand, nameof(editorOptionsFactoryService));
            Guard.ArgumentNotNull(usageTracker, nameof(usageTracker));

            this.serviceProvider         = serviceProvider;
            this.pullRequestService      = pullRequestService;
            this.vsEditorAdaptersFactory = vsEditorAdaptersFactory;
            this.statusBar = statusBar;
            this.goToSolutionOrPullRequestFileCommand = goToSolutionOrPullRequestFileCommand;
            this.editorOptionsFactoryService          = editorOptionsFactoryService;
            this.usageTracker = usageTracker;
        }
예제 #2
0
        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());
        }
예제 #3
0
 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;
 }