Пример #1
0
        private void InitializeCore()
        {
            // ReSharper disable InvertIf
            if (!_isInitialized)
            {
                lock (InitializeLock) {
                    if (!_isInitialized)
                    {
                        try {
                            using (Log.CriticalOperation(nameof(InitializeCore), Serilog.Events.LogEventLevel.Debug)) {
                                var router = new WebViewRouter(
                                    _componentModel,
                                    _componentModel.GetService <ICodeStreamService>(),
                                    _componentModel.GetService <IWebviewUserSettingsService>(),
                                    _componentModel.GetService <ISessionService>(),
                                    _componentModel.GetService <ICodeStreamAgentService>(),
                                    _componentModel.GetService <ISettingsServiceFactory>(),
                                    _eventAggregator,
                                    _browserService,
                                    _componentModel.GetService <IIdeService>(),
                                    _componentModel.GetService <IEditorService>(),
                                    _componentModel.GetService <IAuthenticationServiceFactory>());

                                _browserService.AddWindowMessageEvent(
                                    async delegate(object sender, WindowEventArgs ea) { await router.HandleAsync(ea); });

                                _isInitialized = true;
                            }
                        }
                        catch (Exception ex) {
                            Log.Fatal(ex, nameof(InitializeCore));
                        }
                    }
                }
            }
            // ReSharper restore InvertIf
        }