public async Task InitializeAsync(CancellationToken cancellationToken)
        {
            await SynchronizationContext.InvokeAsync(async() =>
            {
                SetCurrentCircuitHost(this);

                var builder = new ServerSideComponentsApplicationBuilder(Services);

                _configure(builder);

                for (var i = 0; i < builder.Entries.Count; i++)
                {
                    var(componentType, domElementSelector) = builder.Entries[i];
                    Renderer.AddComponent(componentType, domElementSelector);
                }

                for (var i = 0; i < _circuitHandlers.Length; i++)
                {
                    await _circuitHandlers[i].OnCircuitOpenedAsync(Circuit, cancellationToken);
                }

                for (var i = 0; i < _circuitHandlers.Length; i++)
                {
                    await _circuitHandlers[i].OnConnectionUpAsync(Circuit, cancellationToken);
                }
            });

            _initialized = true;
        }
Example #2
0
        public async Task InitializeAsync()
        {
            await SynchronizationContext.Invoke(() =>
            {
                SetCurrentCircuitHost(this);

                var builder = new ServerSideBlazorApplicationBuilder(Services);

                _configure(builder);

                for (var i = 0; i < builder.Entries.Count; i++)
                {
                    var entry = builder.Entries[i];
                    Renderer.AddComponent(entry.componentType, entry.domElementSelector);
                }
            });

            _isInitialized = true;
        }