forked from Militereum/Militereum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirsttime.pas
78 lines (66 loc) · 1.75 KB
/
firsttime.pas
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
unit firsttime;
interface
uses
// Delphi
System.Classes,
System.SysUtils,
// FireMonkey
FMX.Controls,
FMX.Controls.Presentation,
FMX.Objects,
FMX.StdCtrls,
FMX.Types,
// web3
web3,
// project
base,
transaction;
type
TFrmFirstTime = class(TFrmBase)
lblTitle: TLabel;
lblAddressText: TLabel;
Label1: TLabel;
procedure lblAddressTextClick(Sender: TObject);
strict private
procedure SetAddress(value: TAddress);
public
property Address: TAddress write SetAddress;
end;
procedure show(const chain: TChain; const tx: transaction.ITransaction; const address: TAddress; const callback: TProc<Boolean>; const log: TLog);
implementation
uses
// project
cache,
common,
thread;
{$R *.fmx}
procedure show(const chain: TChain; const tx: transaction.ITransaction; const address: TAddress; const callback: TProc<Boolean>; const log: TLog);
begin
const frmFirstTime = TFrmFirstTime.Create(chain, tx, callback, log);
frmFirstTime.Address := address;
frmFirstTime.Show;
end;
{ TFrmFirstTime }
procedure TFrmFirstTime.SetAddress(value: TAddress);
begin
lblAddressText.Text := string(value);
if not common.Demo then
cache.getFriendlyName(Self.Chain, value, procedure(friendly: string; err: IError)
begin
if Assigned(err) then Self.Log(err) else thread.synchronize(procedure
begin
lblAddressText.Text := friendly;
end);
end);
end;
procedure TFrmFirstTime.lblAddressTextClick(Sender: TObject);
begin
cache.fromName(lblAddressText.Text, procedure(address: TAddress; err: IError)
begin
if not Assigned(err) then
common.Open(Self.Chain.Explorer + '/address/' + string(address))
else
common.Open(Self.Chain.Explorer + '/address/' + lblAddressText.Text);
end);
end;
end.