-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBlazorJSBridge.cs
More file actions
115 lines (98 loc) · 4.22 KB
/
BlazorJSBridge.cs
File metadata and controls
115 lines (98 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#region using statements
using Microsoft.JSInterop;
using System.Threading.Tasks;
#endregion
namespace DataJuggler.Blazor.Components
{
#region class BlazorJSBridge
/// <summary>
/// This class [Enter Class Description]
/// </summary>
public static class BlazorJSBridge
{
#region Methods
#region CopyToClipboard(IJSRuntime jsRuntime, string textToCopy)
/// <summary>
/// method Copy To Clipboard
/// </summary>
public static async Task<int> CopyToClipboard(IJSRuntime jsRuntime, string textToCopy)
{
return await jsRuntime.InvokeAsync<int>("BlazorJSFunctions.CopyText", textToCopy);
}
#endregion
#region DeleteCookie(IJSRuntime jsRuntime, string key)
/// <summary>
/// method Delete Cookie
/// </summary>
public static ValueTask DeleteCookie(IJSRuntime jsRuntime, string key)
{
return jsRuntime.InvokeVoidAsync("BlazorJSFunctions.DeleteCookie", key);
}
#endregion
#region GetCookie(IJSRuntime jsRuntime, string key)
/// <summary>
/// method Get Cookie
/// </summary>
public static ValueTask<string> GetCookie(IJSRuntime jsRuntime, string key)
{
return jsRuntime.InvokeAsync<string>("BlazorJSFunctions.GetCookie", key);
}
#endregion
#region HideElement(IJSRuntime jsRuntime, string elementId)
/// <summary>
/// method Hide Element
/// </summary>
public static ValueTask HideElement(IJSRuntime jsRuntime, string elementId)
{
return jsRuntime.InvokeVoidAsync("BlazorJSFunctions.HideElement", elementId);
}
#endregion
#region Prompt(IJSRuntime jsRuntime, string message)
/// <summary>
/// method Prompt
/// </summary>
public static ValueTask<string> Prompt(IJSRuntime jsRuntime, string message)
{
return jsRuntime.InvokeAsync<string>("BlazorJSFunctions.ShowPrompt", message);
}
#endregion
#region SetCookie(IJSRuntime jsRuntime, string key, string value, int expireDays = 30)
/// <summary>
/// method Set Cookie
/// </summary>
public static ValueTask SetCookie(IJSRuntime jsRuntime, string key, string value, int expireDays = 30)
{
return jsRuntime.InvokeVoidAsync("BlazorJSFunctions.SetCookie", key, value, expireDays);
}
#endregion
#region ShowElement(IJSRuntime jsRuntime, string elementId)
/// <summary>
/// method Show Element
/// </summary>
public static ValueTask ShowElement(IJSRuntime jsRuntime, string elementId)
{
return jsRuntime.InvokeVoidAsync("BlazorJSFunctions.ShowElement", elementId);
}
#endregion
#region ShowThenHide(IJSRuntime jsRuntime, string elementId, int duration)
/// <summary>
/// method Show Then Hide
/// </summary>
public static ValueTask ShowThenHide(IJSRuntime jsRuntime, string elementId, int duration)
{
return jsRuntime.InvokeVoidAsync("BlazorJSFunctions.ShowThenHide", elementId, duration);
}
#endregion
#region DownloadFile(IJSRuntime jsRuntime, string url)
/// <summary>
/// method Download File
/// </summary>
public static ValueTask DownloadFile(IJSRuntime jsRuntime, string url)
{
return jsRuntime.InvokeVoidAsync("BlazorJSFunctions.DownloadFile", url);
}
#endregion
#endregion
}
#endregion
}