using Microsoft.JSInterop; namespace HotelPms.Client.Blazor.Util { public static class JSInteropEx { public static async Task SaveAsFileAsync(this IJSRuntime js, string fileName, byte[] data, string type = "application/octet-stream", bool useBom = false) { await js.InvokeAsync("NetCallJs.saveAsFile", fileName, type, Convert.ToBase64String(data), useBom); } public static async Task SetTRTop(this IJSRuntime js, string ownerID, int rowIndex) { await js.InvokeAsync("NetCallJs.setTRTop", ownerID, rowIndex); } public static async Task SetGridWidth(this IJSRuntime js, string ownerID, string width) { await js.InvokeAsync("NetCallJs.setTableWidth", ownerID, width); } public static async Task DelGridCol(this IJSRuntime js, string ownerID, int colIndex) { await js.InvokeAsync("NetCallJs.delTableCol", ownerID, colIndex); } public static async Task SetGridStyle(this IJSRuntime js, string ownerID, string style) { await js.InvokeAsync("NetCallJs.setTableStyle", ownerID, style); } public static async Task RemoveGridClass(this IJSRuntime js, string ownerID, string className) { await js.InvokeAsync("NetCallJs.removeTableClass", ownerID, className); } public static async Task GetClientRectByID(this IJSRuntime js, string id) { return await js.InvokeAsync("NetCallJs.getClientRectByID", id); } /// /// 注意:約0.8秒かかる /// /// /// public static async Task GetWindowSize(this IJSRuntime js) { return await js.InvokeAsync("NetCallJs.getWindowSize"); } public static async Task GetActiveElement(this IJSRuntime js) { return await js.InvokeAsync("NetCallJs.getActiveElement"); } public static async Task SetFocusByKey(this IJSRuntime js, string key) { await js.InvokeAsync("NetCallJs.setFocusByKey", key); } } }