Esempio n. 1
0
 /// <summary>
 /// Constructs an instance of <see cref="WebAssemblyRenderer"/>.
 /// </summary>
 /// <param name="serviceProvider">The <see cref="IServiceProvider"/> to use when initializing components.</param>
 /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
 public WebAssemblyRenderer(IServiceProvider serviceProvider, ILoggerFactory loggerFactory)
     : base(serviceProvider, loggerFactory)
 {
     // The WebAssembly renderer registers and unregisters itself with the static registry
     _webAssemblyRendererId = RendererRegistry.Add(this);
     _logger = loggerFactory.CreateLogger <WebAssemblyRenderer>();
 }
Esempio n. 2
0
        public void RendererRegistry_Remove_DoesNothingOnNonWASM()
        {
            // Act
            var result = RendererRegistry.TryRemove(123);

            // Assert
            Assert.False(result);
        }
Esempio n. 3
0
        public void RendererRegistry_Find_ThrowsErrorOnNonWASM()
        {
            // Act
            Exception ex = Assert.Throws <ArgumentException>(() => RendererRegistry.Find(123));

            // Assert
            Assert.Equal("There is no renderer with ID 123.", ex.Message);
        }
        /// <summary>
        /// Constructs an instance of <see cref="WebAssemblyRenderer"/>.
        /// </summary>
        /// <param name="serviceProvider">The <see cref="IServiceProvider"/> to use when initializing components.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        public WebAssemblyRenderer(IServiceProvider serviceProvider, ILoggerFactory loggerFactory)
            : base(serviceProvider, loggerFactory)
        {
            // The WebAssembly renderer registers and unregisters itself with the static registry
            _webAssemblyRendererId = RendererRegistry.Add(this);
            _logger = loggerFactory.CreateLogger <WebAssemblyRenderer>();

            ElementReferenceContext = DefaultWebAssemblyJSRuntime.Instance.ElementReferenceContext;
        }
Esempio n. 5
0
        public WebAssemblyRenderer(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, JSComponentInterop jsComponentInterop)
            : base(serviceProvider, loggerFactory, DefaultWebAssemblyJSRuntime.Instance.ReadJsonSerializerOptions(), jsComponentInterop)
        {
            // The WebAssembly renderer registers and unregisters itself with the static registry
            RendererId = RendererRegistry.Add(this);
            _logger    = loggerFactory.CreateLogger <WebAssemblyRenderer>();

            ElementReferenceContext = DefaultWebAssemblyJSRuntime.Instance.ElementReferenceContext;
        }
 /// <inheritdoc />
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     RendererRegistry.TryRemove(_webAssemblyRendererId);
 }