Exemple #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);
            }
        }
Exemple #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);
Exemple #4
0
 public void Update()
 {
     JsRuntime.UpdateChart(Config);
 }
        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));
 }
Exemple #7
0
 protected async Task OpenCoverInNewTab()
 {
     await JsRuntime.InvokeAsync <object>("openBase64ImageInNewTab", OneBook.Image.Data);
 }
Exemple #8
0
 protected async Task NavigateToPurchaseLink()
 {
     await JsRuntime.InvokeAsync <object>("open", OneBook.PurchaseLink, "_blank");
 }
Exemple #9
0
 public void Reload()
 {
     JsRuntime.ReloadChart(Config);
 }
 public async void SetToggle(string elementID, bool isChecked)
 {
     await JsRuntime.InvokeVoidAsync("Toggle.setToggle", $"#{elementID}", isChecked);
 }
 public async void SetToggleProp(string elementID, string propName, bool propState)
 {
     await JsRuntime.InvokeVoidAsync("Toggle.setToggleProp", $"#{elementID}", propName, propState);
 }
        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
            });
        }
Exemple #13
0
 public ValueTask AttachToAsync(ElementReference elemRef)
 {
     return(JsRuntime.InvokeVoidAsync("blazorGooglePay.attachButton", elemRef, JsObjectRef));
 }