public StatusBarNotifier([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { RunOnUIThread.Run(() => { vsStatusBar = serviceProvider.GetService(typeof(IVsStatusbar)) as IVsStatusbar; }); }
public void Navigate(ITextView textView, SnapshotSpan snapshotSpan) { RunOnUIThread.Run(() => { ExpandSpan(textView, snapshotSpan); SelectSpan(textView, snapshotSpan); }); }
public ActiveDocumentTracker([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, ITextDocumentProvider textDocumentProvider) { this.textDocumentProvider = textDocumentProvider; RunOnUIThread.Run(() => { monitorSelection = serviceProvider.GetService(typeof(SVsShellMonitorSelection)) as IVsMonitorSelection; monitorSelection.AdviseSelectionEvents(this, out cookie); }); }
public void Notify(string message, bool showSpinner) { RunOnUIThread.Run(() => { object icon = (short)Microsoft.VisualStudio.Shell.Interop.Constants.SBAI_General; vsStatusBar.Animation(showSpinner ? 1 : 0, ref icon); vsStatusBar.SetText(message); }); }
public void Run_StartsOnUIThread_ExecuteOnUIThread() { bool operationExecuted = false; using var hackedThreadingScope = new HackedVSThreadingScope(); // Act RunOnUIThread.Run(() => operationExecuted = true); operationExecuted.Should().BeTrue(); hackedThreadingScope.CheckThreadSwitchNotRequested(); }
public void Run_StartsOnUIThread_ExecuteOnUIThread() { ThreadHelper.SetCurrentThreadAsUIThread(); var initialThread = Thread.CurrentThread.ManagedThreadId; int executionThreadId = -1; // Act RunOnUIThread.Run(() => executionThreadId = Thread.CurrentThread.ManagedThreadId); executionThreadId.Should().Be(initialThread); Thread.CurrentThread.ManagedThreadId.Should().Be(initialThread); // should still be on the "UI" thread }
public async Task Run_StartsOnBackgroundThread_ExecuteOnUIThread() { bool operationExecuted = false; using var hackedThreadingScope = new HackedVSThreadingScope(); // Act await Task.Run(() => { // Now on a background thread, so expecting the VS to request a switch to the main thread RunOnUIThread.Run(() => operationExecuted = true); }); operationExecuted.Should().BeTrue(); hackedThreadingScope.CheckThreadSwitchRequested(); }
private void TagAggregator_TagsChanged(object sender, TagsChangedEventArgs e) { RunOnUIThread.Run(() => lightBulbBroker.DismissSession(textView)); SuggestedActionsChanged?.Invoke(this, EventArgs.Empty); }