Esempio n. 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);
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
 public static ValueTask <object> SaveAs(this IJSRuntime js, string filename, byte[] data)
 {
     return(js.InvokeAsync <object>("saveAsFile", filename, Convert.ToBase64String(data)));
 }
Esempio n. 4
0
 public async ValueTask <string> GetCanvasBase64(ElementReference canvas)
 {
     return(await _jsRuntime.InvokeAsync <string>("CanvasInteropFunctions.getCanvasBase64", canvas));
 }
Esempio n. 5
0
 public ExampleJsInterop(IJSRuntime jsRuntime)
 {
     moduleTask = new(() => jsRuntime.InvokeAsync <IJSObjectReference>(
                          "import", "./_content/GaPackage/exampleJsInterop.js").AsTask());
 }
Esempio n. 6
0
 public static ValueTask <OpenDialogResult> ShowOpenDialog(this IJSRuntime js, OpenDialogOption option)
 {
     return(js.InvokeAsync <OpenDialogResult>("showOpenDialog", option));
 }
Esempio n. 7
0
 public async Task CreateCookie(string name, string value, int days = 30)
 {
     await jsRuntime.InvokeAsync <string>("methods.CreateCookie", name, value, days);
 }
Esempio n. 8
0
 public async Task <string?> GetItem(string key)
 {
     return(await _jsRuntime.InvokeAsync <string>("localStorage.getItem", key));
 }
Esempio n. 9
0
 public async Task <int> GetInnerHeight()
 {
     return(await _jsRuntime.InvokeAsync <int>("browserResize.getInnerHeight"));
 }
Esempio n. 10
0
 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);
        }
Esempio n. 12
0
 public CustomNavInterop(IJSRuntime jsRuntime)
 {
     moduleTask = new(() => jsRuntime.InvokeAsync <IJSObjectReference>(
                          "import", "./_content/Components/js/CustomEventHandlers.js").AsTask());
 }
Esempio n. 13
0
 public Task SetStringAsync(string key, string value)
 {
     _jsRuntime.InvokeAsync <string>("set", key, value);
     return(Task.CompletedTask);
 }
Esempio n. 14
0
 public static Task <double> GetScrollTop(this IJSRuntime JSRuntime, string id)
 {
     return(JSRuntime.InvokeAsync <double>("chat.getScrollTop", id));
 }
Esempio n. 15
0
 public static Task <bool> ScrollIntoView(this IJSRuntime JSRuntime, string id)
 {
     return(JSRuntime.InvokeAsync <bool>("chat.scrollIntoView", id));
 }
Esempio n. 16
0
        public async Task <string> GetValue(string key)
        {
            var value = await _jsRuntime.InvokeAsync <string>(_localStorageMethods.Get, key);

            return(value);
        }
Esempio n. 17
0
 public MediaQueryService(IJSRuntime jsRuntime)
 {
     moduleTask = new(() => jsRuntime.InvokeAsync <IJSObjectReference>(
                          "import", "./_content/BlazorPro.BlazorSize/blazorSizeMediaModule.js").AsTask());
 }
Esempio n. 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);
     }
 }
Esempio n. 19
0
 public async ValueTask <bool> HasGeolocationFeature() =>
 await js.InvokeAsync <bool>("blazorGeolocation.hasGeolocaitonFeature");
Esempio n. 20
0
 /// <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);
Esempio n. 21
0
 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));
        }
Esempio n. 23
0
 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));
 }
Esempio n. 27
0
        /*
         * 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));
 }
Esempio n. 29
0
 internal void ConstructDOM()
 {
     JSRuntime?.InvokeAsync <object>("eval", "DC.LoadingBar.constructDOM()");
 }
Esempio n. 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));
        }