예제 #1
0
 private void AdviseBuildEvents()
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
     {
         UpdateSolutionEventsListener solutionEventsListener = this;
         await Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
         solutionEventsListener._buildCommandIntercepter = BuildCommandIntercepter.InitializeCommandInterceptor(solutionEventsListener._serviceProvider);
         solutionEventsListener._buildCommandIntercepter.UserInitiatedBuild += solutionEventsListener.OnUserInitiatedBuild;
     });
 }
예제 #2
0
 private void UnadviseBuildEvents()
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
     {
         UpdateSolutionEventsListener solutionEventsListener = this;
         await Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
         if (solutionEventsListener._buildCommandIntercepter == null)
         {
             return;
         }
         solutionEventsListener._buildCommandIntercepter.UserInitiatedBuild -= solutionEventsListener.OnUserInitiatedBuild;
         solutionEventsListener._buildCommandIntercepter.Dispose();
         solutionEventsListener._buildCommandIntercepter = null;
     });
 }
예제 #3
0
 public NotificationDisabler(UpdateSolutionEventsListener listener)
 {
     _listener = listener ?? throw new ArgumentNullException(nameof(listener));
     _listener._eventsEnabled = false;
 }