示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("bitness: " + (IntPtr.Size == 8 ? "64" : "32") + "-bit");
            using (var jsrt = new JsRuntime(JsRuntime.JsRuntimeVersion.JsRuntimeVersion11))
            {
                // if null, we probably loaded jscript9.dll
                Console.WriteLine("NativeRuntimePath:" + JsRuntime.NativeRuntimePath);

                Console.WriteLine("EngineVersion:" + jsrt.EngineVersion);
                Console.WriteLine("MemoryLimit:" + jsrt.MemoryLimit);
                Console.WriteLine("MemoryUsage:" + jsrt.MemoryUsage);
            }
        }
示例#2
0
 public async ValueTask AddIceCandidate(RTCIceCandidateInit candidate)
 {
     await JsRuntime.InvokeInstanceMethod(JsObjectRef, "addIceCandidate", candidate)
     .ConfigureAwait(false);
 }
 /// <inheritdoc/>
 private protected override async Task InitializeMdcComponent() => await JsRuntime.InvokeVoidAsync("material_blazor.datePicker.init", ElementReference);
示例#4
0
 public void Update()
 {
     JsRuntime.UpdateChart(Config);
 }
示例#5
0
        protected async Task Save()
        {
            await JsRuntime.InvokeVoidAsync("laterlist.collapse", $"#{CollapseCardId}", "hide");

            await OnSave.InvokeAsync(InternalTodoList);
        }
 /// <summary>
 /// Callback for value the value setter.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void OnValueSetCallback(object sender, EventArgs e)
 {
     Panel.SetParameters(true, Value);
     InvokeAsync(() => JsRuntime.InvokeVoidAsync("material_blazor.datePicker.listItemClick", Panel.ListItemReference, Utilities.DateToString(Value, DateFormat)).ConfigureAwait(false));
 }
示例#7
0
 protected async Task OpenCoverInNewTab()
 {
     await JsRuntime.InvokeAsync <object>("openBase64ImageInNewTab", OneBook.Image.Data);
 }
示例#8
0
 protected async Task NavigateToPurchaseLink()
 {
     await JsRuntime.InvokeAsync <object>("open", OneBook.PurchaseLink, "_blank");
 }
示例#9
0
 public void Reload()
 {
     JsRuntime.ReloadChart(Config);
 }
示例#10
0
 public async void SetToggle(string elementID, bool isChecked)
 {
     await JsRuntime.InvokeVoidAsync("Toggle.setToggle", $"#{elementID}", isChecked);
 }
示例#11
0
 public async void SetToggleProp(string elementID, string propName, bool propState)
 {
     await JsRuntime.InvokeVoidAsync("Toggle.setToggleProp", $"#{elementID}", propName, propState);
 }
示例#12
0
        public RenderFragment GenerateContent(T pModel)
        {
            return(builder =>
            {
                builder.OpenElement(1, "div");

                builder.AddAttribute(2, "class", "m-action-column-cell m-action-column-btn-group");

                if (mGrid.EnableEditing)
                {
                    builder.OpenElement(1, "button");
                    builder.AddAttribute(2, "class", "m-btn m-btn-secondary m-btn-icon m-btn-sm");
                    builder.AddAttribute(21, "onclick", EventCallback.Factory.Create <MouseEventArgs>(this, (a) =>
                    {
                        Grid.StartEditRow(pModel, a);
                    }));
                    builder.AddEventStopPropagationClicksAttribute(22);

                    builder.OpenElement(1, "i");
                    builder.AddAttribute(3, "class", "fas fa-edit m-grid-action-icon");

                    builder.CloseElement(); //i

                    builder.CloseElement(); //button
                }

                if (mGrid.EnableDeleting)
                {
                    builder.OpenElement(1, "button");
                    builder.AddAttribute(2, "class", "m-btn m-btn-secondary m-btn-icon m-btn-sm");
                    builder.AddAttribute(2, "style", "margin-left: 4px;");
                    builder.AddAttribute(21, "onclick", EventCallback.Factory.Create <MouseEventArgs>(this, (a) =>
                    {
                        if (Settings.UseDeleteConfirmationWithAlert)
                        {
                            RowDeleteEnabled = pModel;
                            Grid.Formatter.ClearRowMetadata();
                            Grid.Formatter.AddRowMetadata(pModel, MGridDefaultObjectFormatter <T> .ROW_DELETE_METADATA);
                            StateHasChanged();
                            Grid.InvokeStateHasChanged();
                            return;
                        }

                        if (RowDeleteEnabled == null || !RowDeleteEnabled.Equals(pModel))
                        {
                            RowDeleteEnabled = pModel;
                            Grid.Formatter.ClearRowMetadata();
                            Grid.Formatter.AddRowMetadata(pModel, MGridDefaultObjectFormatter <T> .ROW_DELETE_METADATA);

                            RowDeleteEnabled = pModel;
                            mDeleteResetTimer.Stop();

                            RowDeleteClicked = DateTime.UtcNow;
                            mDeleteResetTimer.Start();
                            StateHasChanged();
                            Grid.InvokeStateHasChanged();
                            return;
                        }

                        if (DateTime.UtcNow.Subtract(RowDeleteClicked).TotalMilliseconds < 500)
                        {
                            return;
                        }

                        mDeleteResetTimer.Stop();
                        mDeleteResetTimer.Start();

                        _ = Grid.StartDeleteRow(pModel, a);
                    }));
                    builder.AddEventStopPropagationClicksAttribute(22);

                    builder.OpenElement(1, "i");

                    if (RowDeleteEnabled != null && RowDeleteEnabled.Equals(pModel))
                    {
                        builder.AddAttribute(3, "class", "fas fa-trash-alt m-grid-action-icon");

                        if (Settings.UseDeleteConfirmationWithAlert)
                        {
                            Task.Delay(150).ContinueWith(async t =>
                            {
                                bool confirmed = await JsRuntime.InvokeAsync <bool>("confirm", L["Are you sure?"].ToString());

                                RowDeleteEnabled = null;
                                Grid.Formatter.ClearRowMetadata();

                                if (confirmed)
                                {
                                    _ = InvokeAsync(() => _ = Grid.StartDeleteRow(pModel, null));
                                }
                                else
                                {
                                    Grid.InvokeStateHasChanged();
                                }
                            });
                        }
                    }
                    else
                    {
                        builder.AddAttribute(3, "class", "fas fa-trash-alt m-grid-action-icon m-grid-action-icon--disabled");
                    }

                    builder.CloseElement(); //i

                    builder.CloseElement(); //button
                }

                builder.CloseElement(); //div
            });
        }
示例#13
0
 public ValueTask AttachToAsync(ElementReference elemRef)
 {
     return(JsRuntime.InvokeVoidAsync("blazorGooglePay.attachButton", elemRef, JsObjectRef));
 }