Exemple #1
0
 public static ValueTask <bool> CreateOrJoinRoomAsync(
     this IJSRuntime?jsRuntime,
     string roomName,
     string token) =>
 jsRuntime?.InvokeAsync <bool>(
     "videoInterop.createOrJoinRoom",
     roomName, token) ?? new ValueTask <bool>(false);
        public async Task Create(string elId, SortableJsOptions opt)
        {
            _opt = opt;

            await _jSRuntime?.InvokeAsync <object>("BlazorSortableJS.Create", _refId, elId, opt.RemoveNulls());

            //Register to all Events
            SortableJSEventHandler.OnChooseEvent   += OnChoose;
            SortableJSEventHandler.OnUnchooseEvent += OnUnchoose;
            SortableJSEventHandler.OnStartEvent    += OnStart;
            SortableJSEventHandler.OnEndEvent      += OnEnd;
            SortableJSEventHandler.OnAddEvent      += OnAdd;
            SortableJSEventHandler.OnUnchooseEvent += OnUpdate;
            SortableJSEventHandler.OnSortEvent     += OnSort;
            SortableJSEventHandler.OnRemoveEvent   += OnRemove;
            SortableJSEventHandler.OnFilterEvent   += OnFilter;
            SortableJSEventHandler.OnMoveEvent     += OnMove;
            SortableJSEventHandler.OnCloneEvent    += OnClone;
            SortableJSEventHandler.OnChangeEvent   += OnChange;
        }
Exemple #3
0
 public static ValueTask <object> SaveAs(this IJSRuntime js, string filename, byte[] data)
 {
     return(js.InvokeAsync <object>("saveAsFile", filename, Convert.ToBase64String(data)));
 }
Exemple #4
0
 public async ValueTask <string> GetCanvasBase64(ElementReference canvas)
 {
     return(await _jsRuntime.InvokeAsync <string>("CanvasInteropFunctions.getCanvasBase64", canvas));
 }
Exemple #5
0
 public ExampleJsInterop(IJSRuntime jsRuntime)
 {
     moduleTask = new(() => jsRuntime.InvokeAsync <IJSObjectReference>(
                          "import", "./_content/GaPackage/exampleJsInterop.js").AsTask());
 }
Exemple #6
0
 public static ValueTask <OpenDialogResult> ShowOpenDialog(this IJSRuntime js, OpenDialogOption option)
 {
     return(js.InvokeAsync <OpenDialogResult>("showOpenDialog", option));
 }
Exemple #7
0
 public async Task CreateCookie(string name, string value, int days = 30)
 {
     await jsRuntime.InvokeAsync <string>("methods.CreateCookie", name, value, days);
 }
Exemple #8
0
 public async Task <string?> GetItem(string key)
 {
     return(await _jsRuntime.InvokeAsync <string>("localStorage.getItem", key));
 }
Exemple #9
0
 public async Task <int> GetInnerHeight()
 {
     return(await _jsRuntime.InvokeAsync <int>("browserResize.getInnerHeight"));
 }
 public async ValueTask <string> TickerChanged(string symbol, decimal price)
 {
     return(await js.InvokeAsync <string>("displayTickerAlert2", symbol, price));
 }
        public async Task <string> GetItem(string key)
        {
            var item = await _jsRuntime.InvokeAsync <string>("localStorage.getItem", key);

            return(item);
        }
Exemple #12
0
 public CustomNavInterop(IJSRuntime jsRuntime)
 {
     moduleTask = new(() => jsRuntime.InvokeAsync <IJSObjectReference>(
                          "import", "./_content/Components/js/CustomEventHandlers.js").AsTask());
 }
 public Task SetStringAsync(string key, string value)
 {
     _jsRuntime.InvokeAsync <string>("set", key, value);
     return(Task.CompletedTask);
 }
Exemple #14
0
 public static Task <double> GetScrollTop(this IJSRuntime JSRuntime, string id)
 {
     return(JSRuntime.InvokeAsync <double>("chat.getScrollTop", id));
 }
Exemple #15
0
 public static Task <bool> ScrollIntoView(this IJSRuntime JSRuntime, string id)
 {
     return(JSRuntime.InvokeAsync <bool>("chat.scrollIntoView", id));
 }
Exemple #16
0
        public async Task <string> GetValue(string key)
        {
            var value = await _jsRuntime.InvokeAsync <string>(_localStorageMethods.Get, key);

            return(value);
        }
Exemple #17
0
 public MediaQueryService(IJSRuntime jsRuntime)
 {
     moduleTask = new(() => jsRuntime.InvokeAsync <IJSObjectReference>(
                          "import", "./_content/BlazorPro.BlazorSize/blazorSizeMediaModule.js").AsTask());
 }
Exemple #18
0
 public Task SetCookie(string name, string value, int days)
 {
     try
     {
         _jsRuntime.InvokeAsync <string>(
             "interop.setCookie",
             name, value, days);
         return(Task.CompletedTask);
     }
     catch
     {
         return(Task.CompletedTask);
     }
 }
 public async ValueTask <bool> HasGeolocationFeature() =>
 await js.InvokeAsync <bool>("blazorGeolocation.hasGeolocaitonFeature");
 /// <summary>
 /// Recovery data from SessionStorage
 /// </summary>
 /// <param name="jsRuntume"></param>
 /// <param name="key">name of the variable in the LocalStorage</param>
 /// <returns></returns>
 public static async ValueTask <string> SessionStorageGetAsync(this IJSRuntime jsRuntume, string key) =>
 await jsRuntume.InvokeAsync <string>("MySessionStorage.Get", key);
 public Task <IEnumerable <TodoItem> > GetTodosFromStorage()
 {
     return(jSRuntime.InvokeAsync <IEnumerable <TodoItem> >("getTodos"));
 }
        public static async ValueTask <bool> Confirm(this IJSRuntime jS, string mensaje)
        {
            await jS.InvokeVoidAsync("console.log", "Pruena de console log");

            return(await jS.InvokeAsync <bool>("confirm", mensaje));
        }
 public async Task <BrowserDimension> GetDimensions()
 {
     return(await _js.InvokeAsync <BrowserDimension>("getDimensions"));
 }
 public static ValueTask <object> SetInLocalStorage(this IJSRuntime js, string key, string content)
 {
     return(js.InvokeAsync <object>("localStorage.setItem", key, content));
 }
 public static ValueTask <bool> Confirm(this IJSRuntime jsRuntime, string message)
 {
     return(jsRuntime.InvokeAsync <bool>("confirm", message));
 }
 public static ValueTask <string> GetFromLocalStorage(this IJSRuntime js, string key)
 {
     return(js.InvokeAsync <string>("localStorage.getItem", key));
 }
        /*
         * TODO: API surface to include:
         *
         *     Creating or joining a room given a name
         *     Getting all rooms (display name and id)
         *     Get auth token from Web API
         *     SignalR: broadcast new rooms
         *
         */

        public static ValueTask <Device[]> GetVideoDevicesAsync(
            IJSRuntime?jsRuntime) =>
        jsRuntime?.InvokeAsync <Device[]>(
            "videoInterop.getVideoDevices") ?? new ValueTask <Device[]>();
 public static ValueTask <object> RemoveItem(this IJSRuntime js, string key)
 {
     return(js.InvokeAsync <object>("localStorage.removeItem", key));
 }
Exemple #29
0
 internal void ConstructDOM()
 {
     JSRuntime?.InvokeAsync <object>("eval", "DC.LoadingBar.constructDOM()");
 }
Exemple #30
0
        public static async ValueTask <bool> Confirm(this IJSRuntime js, string message)
        {
            await js.InvokeVoidAsync("console.log", "example message");

            return(await js.InvokeAsync <bool>("confirm", message));
        }