Exemplo n.º 1
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            if (firstRender)
            {
                try
                {
                    if (IsWebAssembley)
                    {
                        module = await _jsInProcessRuntime.InvokeAsync <IJSInProcessObjectReference>("import", "./Scripts/BasicCanvas.js");

                        module.InvokeVoid("initializeBasicCanvas", CanvasId, IsWebAssembley, IsTransparent, IsDesyncronized);
                    }
                    else
                    {
                        asyncModule = await JS_Runtime.InvokeAsync <IJSObjectReference>("import", "./Scripts/BasicCanvas.js");

                        await asyncModule.InvokeVoidAsync("initializeBasicCanvas", CanvasId, IsWebAssembley, IsTransparent, IsDesyncronized);
                    }

                    if (CanvasInitComplete != null)
                    {
                        CanvasInitComplete(this);
                    }
                }
                catch (Exception ex)
                {
                    var crap = ex.Message;
                }
            }
        }
Exemplo n.º 2
0
        private async void Init(IJSInProcessRuntime runtime, ElementReference?element, PoseNetOptions options, DetectionType?type)
        {
            Runtime         = runtime;
            DotNetObjectRef = DotNetObjectReference.Create(this);
            JSReference     = await Runtime.InvokeAsync <IJSInProcessObjectReference>("import", "./_content/BlazorML5/ml5PoseNet.js");

            Hash = PoseNetHash++;
            JSReference.InvokeVoid("poseNetML5", Hash.ToString(), DotNetObjectRef, element, options, type);
        }
Exemplo n.º 3
0
 public async Task <GraphAccount> GetUserAccountAsync() =>
 await _jsRuntime.InvokeAsync <GraphAccount>("getUserAccount", _config);
 public KnightAnimInterop(IJSInProcessRuntime jsRuntime)
 {
     moduleTask = new(() => jsRuntime.InvokeAsync <IJSInProcessObjectReference>(
                          "import", "./_content/CanvasAnimateRCL/animateKnightDirect.js").AsTask());
 }
        public static async ValueTask <bool> Confirm(this IJSInProcessRuntime jSInProcessRuntime, string message)
        {
            await jSInProcessRuntime.InvokeVoidAsync("console.log", "Example Message");

            return(await jSInProcessRuntime.InvokeAsync <bool>("confirm", message));
        }