protected override async Task OnInitializedAsync() { ScriptBlockRunner.Start += (object sender) => InvokeAsync(() => StateHasChanged()); ScriptBlockRunner.Finish += (object sender, ScriptResult result) => InvokeAsync(() => StateHasChanged()); Inputs = await ScriptBlockRunner.GetInputs(); await base.OnInitializedAsync(); }
public async Task RunScript() { try { Executing = true; Inputs = await ScriptBlockRunner?.GetInputs(); if (Inputs.Any()) { await ExecuteWithInputs(); } else { await Execute(); } } catch (Exception ex) { await Task.Run(() => Error?.Invoke("Error running script.", ex)); } }