コード例 #1
0
        /// <summary>
        ///  Initializes the <see cref="InteropWindow"/>.
        /// </summary>
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            //This can be called more then once
            if (!firstRender)
            {
                return;
            }

            //Load the sound interop in JavaScript
            _interopSounds = new InteropSounds(JsRuntime);

            if (!await _interopSounds.Initialize(_controller.ActionSounds))
            {
                Console.WriteLine($"ERROR '{nameof(InteropSounds)}': Could not initialize sounds in JavaScript.");
            }

            //Load the window interop in JavaScript
            _interopWindow = new InteropWindow(JsRuntime);
            await _interopWindow.Initialize();

            //Force a refresh
            await InvokeAsync(StateHasChanged);
        }
コード例 #2
0
        /// <summary>
        /// Loads the sound streams in JavaScript.
        /// </summary>
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            //Load the sounds in JavaScript
            _interopSounds = new InteropSounds(JsRuntime);

            if (!await _interopSounds.Initialize(_controller.ActionSounds))
            {
                Console.WriteLine($"ERROR '{nameof(InteropSounds)}': Could not initialize sounds in JavaScript.");
            }
        }