private async Task HandleOpenSolutionAsync(CancellationToken cancellationToken) { await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); if (!ConstFinder.HasParsedSolution) { await ConstFinder.TryParseSolutionAsync(); } }
public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame) { // if (fFirstShow == 1) { ThreadHelper.JoinableTaskFactory.Run(async() => await ConstFinder.ReloadConstsAsync()); } return(VSConstants.S_OK); }
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await this.LoadSystemTextSettingsAsync(cancellationToken); Microsoft.VisualStudio.Shell.Events.SolutionEvents.OnAfterOpenSolution += this.HandleOpenSolution; Microsoft.VisualStudio.Shell.Events.SolutionEvents.OnAfterCloseSolution += this.HandleCloseSolution; await this.SetUpRunningDocumentTableEventsAsync(cancellationToken).ConfigureAwait(false); var componentModel = GetGlobalService(typeof(SComponentModel)) as IComponentModel; await ConstFinder.TryParseSolutionAsync(componentModel); VSColorTheme.ThemeChanged += (e) => this.LoadSystemTextSettingsAsync(CancellationToken.None).LogAndForget(nameof(ConstVisualizerPackage)); await SponsorRequestHelper.CheckIfNeedToShowAsync(); Instance = this; }
private void HandleCloseSolution(object sender, EventArgs e) { ConstFinder.Reset(); }
public int OnAfterSave(uint docCookie) { ThreadHelper.JoinableTaskFactory.Run(async() => await ConstFinder.ReloadConstsAsync()); return(VSConstants.S_OK); }