-
Notifications
You must be signed in to change notification settings - Fork 1
/
BlazorJSBridge.cs
95 lines (74 loc) · 2.91 KB
/
BlazorJSBridge.cs
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
#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 class BlazorJSBridge
{
#region Private Variables
#endregion
#region Events
#endregion
#region Methods
#region CopyToClipboard(IJSRuntime jsRuntime, string textToCopy)
/// <summary>
/// method Copy To Clipboard
/// </summary>
public async static Task<int> CopyToClipboard(IJSRuntime jsRuntime, string textToCopy)
{
// set the value
int copied = await jsRuntime.InvokeAsync<int>("BlazorJSFunctions.CopyText", textToCopy);
// return value
return copied;
}
#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)
{
// Implemented in BlazorJSInterop.js
return jsRuntime.InvokeAsync<string>(
"BlazorJSFunctions.ShowPrompt",
message);
}
#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
#endregion
#region Properties
#endregion
}
#endregion
}