public void StartListening()
        {
            _observable        = _eventAggregator.GetEvent <ConnectionChangedEvent>().Subscribe(ConnectionChanged);
            _observableHistory = _eventAggregator.GetEvent <ClientHistoryChangedEvent>().Subscribe(ClientHistoryChanged);
            _observableProject = _eventAggregator.GetEvent <ActiveProjectChangedEvent>().Subscribe(ActiveProjectChanged);

            _themeObs = Observable
                        .FromEvent <ThemeChangedEventHandler, ThemeChangedEventArgs>(handler => VSColorTheme.ThemeChanged += handler, handler => VSColorTheme.ThemeChanged -= handler)
                        .Subscribe(args =>
            {
                CurrentTheme = ConvertToTheme(VSHelpers.DetectTheme());
                _eventAggregator.Publish(new ThemeChangedEvent(CurrentTheme));
            });
        }
Beispiel #2
0
        public PullRequestNavigationItem(
            IYouTrackClientService youTrackClientService,
            IGitService gitService,
            IEventAggregatorService eventAggregator,
            IUserInformationService userInformationService,
            ICommandsService commandService
            ) : base(null)
        {
            _youTrackClientService  = youTrackClientService;
            _gitService             = gitService;
            _eventAggregator        = eventAggregator;
            _userInformationService = userInformationService;
            _commandService         = commandService;
            Text      = Resources.PullRequestNavigationItemTitle;
            Image     = Resources.PullRequest;
            IsVisible = ShouldBeVisible(_userInformationService.ConnectionData);
            var connectionObs = _eventAggregator.GetEvent <ConnectionChangedEvent>();
            var repoObs       = _eventAggregator.GetEvent <ActiveRepositoryChangedEvent>();

            _observable = connectionObs.Select(x => Unit.Default).Merge(repoObs.Select(x => Unit.Default)).Subscribe(_ => ValidateVisibility());
        }
Beispiel #3
0
 public PublishSection(
     IPublishSectionView view,
     IAppServiceProvider appServiceProvider,
     IGitClientService gitClientService,
     IGitWatcher gitWatcher,
     IUserInformationService userInformationService,
     IEventAggregatorService eventAggregator
     ) : base(view)
 {
     _appServiceProvider     = appServiceProvider;
     _userInformationService = userInformationService;
     _eventAggregator        = eventAggregator;
     Title     = $"{Resources.PublishSectionTitle} to {gitClientService.Origin}";
     IsVisible = IsGitLocalRepoAndLoggedIn(gitWatcher.ActiveRepo);
     _obs      = _eventAggregator.GetEvent <ActiveRepositoryChangedEvent>().Subscribe(x => IsVisible = IsGitLocalRepoAndLoggedIn(x.ActiveRepository));
 }