public async Task InitializeAsync(CancellationToken cancellationToken)
        {
            await TaskScheduler.Default;
            // do background operations that involve IO or other async methods

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            // query Visual Studio services on main thread unless they are documented as free threaded explicitly.
            // The reason for this is the final cast to service interface (such as IVsShell) may involve COM operations to add/release references.

            _fileCache            = new SccProviderSolutionCache(_sccProvider);
            _fileChangesetManager = new ConcurrentDictionary <GitRepository, GitChangesetManager>();

            RepositoryManager.Instance.FilesChanged                 += RepositoryManager_FilesChanged;
            RepositoryManager.Instance.FileStatusUpdate             += RepositoryManager_FileStatusUpdate;
            RepositoryManager.Instance.SolutionTrackerBranchChanged += RepositoryManager_SolutionTrackerBranchChanged;
            RepositoryManager.Instance.CommitChanged                += RepositoryManager_CommitChanged;

            //var mcs = sccProvider.GetService(typeof(IMenuCommandService)) as Microsoft.VisualStudio.Shell.OleMenuCommandService;
            _statusBarManager = new StandardGitStatusBarManager(
                GuidList.guidSccProviderCmdSet,
                PackageIds.cmdidBranchmenuStart,
                PackageIds.cmdidBranchMenuCommandStart,
                PackageIds.cmdidRepositorymenuStart,
                _sccProvider,
                this);
            //this.trackers = trackers;
            SetupSolutionEvents();
            SetupDocumentEvents();
        }
Esempio n. 2
0
        //private List<GitFileStatusTracker> trackers;


        #region SccProvider Service initialization/unitialization
        public SccProviderService(BasicSccProvider sccProvider)
        {
            this._sccProvider     = sccProvider;
            _fileCache            = new SccProviderSolutionCache(_sccProvider);
            _fileChangesetManager = new ConcurrentDictionary <GitRepository, GitChangesetManager>();

            RepositoryManager.Instance.FilesChanged                 += RepositoryManager_FilesChanged;
            RepositoryManager.Instance.FileStatusUpdate             += RepositoryManager_FileStatusUpdate;
            RepositoryManager.Instance.SolutionTrackerBranchChanged += RepositoryManager_SolutionTrackerBranchChanged;

            //var mcs = sccProvider.GetService(typeof(IMenuCommandService)) as Microsoft.VisualStudio.Shell.OleMenuCommandService;
            _statusBarManager = new StandardGitStatusBarManager(
                GuidList.guidSccProviderCmdSet,
                PackageIds.cmdidBranchmenuStart,
                PackageIds.cmdidBranchMenuCommandStart,
                PackageIds.cmdidRepositorymenuStart,
                sccProvider,
                this);
            //this.trackers = trackers;
            SetupSolutionEvents();
            SetupDocumentEvents();
        }
        //private List<GitFileStatusTracker> trackers;


        #region SccProvider Service initialization/unitialization
        public SccProviderService(BasicSccProvider sccProvider)
        {
            this._sccProvider = sccProvider;
            _fileCache = new SccProviderSolutionCache(_sccProvider);
            _fileChangesetManager = new ConcurrentDictionary<GitRepository, GitChangesetManager>();

            RepositoryManager.Instance.FilesChanged += RepositoryManager_FilesChanged;
            RepositoryManager.Instance.FileStatusUpdate += RepositoryManager_FileStatusUpdate;
            RepositoryManager.Instance.SolutionTrackerBranchChanged += RepositoryManager_SolutionTrackerBranchChanged;

            //var mcs = sccProvider.GetService(typeof(IMenuCommandService)) as Microsoft.VisualStudio.Shell.OleMenuCommandService;
            _statusBarManager = new StandardGitStatusBarManager(
                GuidList.guidSccProviderCmdSet,
                PackageIds.cmdidBranchmenuStart,
                PackageIds.cmdidBranchMenuCommandStart,
                PackageIds.cmdidRepositorymenuStart,
                sccProvider,
                this);
            //this.trackers = trackers;
            SetupSolutionEvents();
            SetupDocumentEvents();
        }