/// <summary> /// Initializes a new instance of the <see cref="WebViewControl"/> class. /// </summary> public WebViewControl() { try { using (Log.CriticalOperation($"ctor", Serilog.Events.LogEventLevel.Debug)) { this.IsVisibleChanged += WebViewControl_IsVisibleChanged; InitializeComponent(); _componentModel = Package.GetGlobalService(typeof(SComponentModel)) as IComponentModel; Assumes.Present(_componentModel); _eventAggregator = _componentModel.GetService <IEventAggregator>(); _sessionService = _componentModel.GetService <ISessionService>(); _browserService = _componentModel.GetService <IBrowserService>(); _ = _browserService.InitializeAsync().ContinueWith(_ => { ThreadHelper.JoinableTaskFactory.Run(async delegate { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); // requires UI thread _browserService.AttachControl(Grid); _browserService.LoadSplashView(); _languageServerDisconnectedEvent = _eventAggregator?.GetEvent <LanguageServerDisconnectedEvent>() .Subscribe(e => { Log.Debug($"{nameof(LanguageServerDisconnectedEvent)} IsReloading={e?.IsReloading}"); // if we're in the process of reloading the agent, don't show the splash screen if (e.IsReloading) { return; } _browserService.LoadSplashView(); }); SetupInitialization(); }); }, TaskScheduler.Default); } } catch (Exception ex) { Log.Fatal(ex.UnwrapCompositionException(), nameof(WebViewControl)); } }