-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSignatureScriptClass.uno
51 lines (40 loc) · 993 Bytes
/
SignatureScriptClass.uno
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
using Uno;
using Uno.Compiler.ExportTargetInterop;
using Uno.Time;
using Fuse;
using Fuse.Controls;
using Fuse.Controls.Native;
using Fuse.Scripting;
namespace Native
{
public partial class Signature
{
static Signature()
{
ScriptClass.Register(typeof(Signature),
new ScriptMethod<Signature>("Save", Save, ExecutionThread.MainThread),
new ScriptMethod<Signature>("ClearSignature", ClearSignature, ExecutionThread.MainThread));
}
static void Save(Context c, Signature signature, object[] args)
{
var dpv = signature.SignatureView;
var filename = (string)args[0];
if (args.Length != 1)
{
Fuse.Diagnostics.UserError( "retrieve requires 1 argument, the value of the item", signature);
return;
}else{
if(dpv != null){
dpv.Save(filename);
}
}
}
static void ClearSignature(Context c, Signature signature, object[] args)
{
var dpv = signature.SignatureView;
if(dpv != null){
dpv.ClearSignature();
}
}
}
}