Пример #1
0
        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();
        }
Пример #2
0
        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));
            }
        }