public void Activate() { IVsSolutionEventsHandler vsSolutionEvents = new VsSolutionEventsHandler(_visualStudioPackageProvider); vsSolutionEvents.AfterOpenSolution += AfterOpenSolutionHandler; vsSolutionEvents.BeforeCloseSolution += BeforeCloseSolutionHandler; _fileSystemTreeSource.TreeReceived += OnTreeReceived; _fileSystemTreeSource.ErrorReceived += OnErrorReceived; var mcs = _visualStudioPackageProvider.Package.OleMenuCommandService; if (mcs != null) { var cmd = new SimplePackageCommandHandler( new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidSyncWithActiveDocument), enabled: () => !_hierarchy.IsEmpty, visible: () => _globalSettingsProvider.GlobalSettings.EnableSourceExplorerHierarchy && !_hierarchy.IsEmpty, execute: (s, e) => SyncToActiveDocument()); mcs.AddCommand(cmd.ToOleMenuCommand()); } RegisterHierarchyCommands(_hierarchy); _nodeTemplateFactory.Activate(); _eventBus.RegisterHandler(EventNames.SolutionExplorer.ShowFile, ShowInSolutionExplorerHandler); _globalSettingsProvider.GlobalSettings.PropertyChanged += GlobalSettingsOnPropertyChanged; SynchronizeHierarchy(); }
internal SolutionEventsHandler(VsSolutionEventsHandler vsSolutionEventsHandler) { _vsSolutionEventsHandler = vsSolutionEventsHandler; }