Beispiel #1
0
 internal GooglePayButton(IJSRuntime jsRuntime,
                          GoogleButtonType type,
                          GooglePayButtonColor?color = null)
 {
     JsRuntime = jsRuntime;
     Type      = type;
     Color     = color;
 }
Beispiel #2
0
        public async ValueTask <GooglePayButton> CreateButtonAsync(GoogleButtonType type,
                                                                   GooglePayButtonColor?color = null)
        {
            var button   = new GooglePayButton(_jsRuntime, type, color);
            var callback = CallBackInteropWrapper.Create(async() =>
            {
                var isHandled = await OnButtonClicked(button);
                if (!isHandled)
                {
                    await button.OnClicked();
                }
            },
                                                         serializationSpec: false);

            button.JsObjectRef = await _jsRuntime.InvokeAsync <JsRuntimeObjectRef>(
                "blazorGooglePay.createButton",
                _jsObjectRef,
                callback,
                type,
                color);

            return(button);
        }