private async Task AttachTitleBarButtonAsync() { var dispatcher = Application.Current.Dispatcher; if (dispatcher == null) { throw new InvalidOperationException("Application.Current.Dispatcher == null"); } while (true) { var titleBarButton = ServiceLocator.Instance.Resolve <TitleBarButton>(); var attached = await dispatcher.InvokeAsync( () => VsUi.AttachTitleBarButton(titleBarButton), DispatcherPriority.ApplicationIdle); if (attached) { break; } await Task.Delay(1000); } }
private void OnTimerElapsed(object sender, ElapsedEventArgs e) { VsUi.BeginInvoke(this.GetAndPublishPredictions); }