|
@@ -80,7 +80,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="modal__input__button">
|
|
|
- <button class="btn_orange btn_center">ОК</button>
|
|
|
+ <button @onclick="@Ok" class="btn_orange btn_center">ОК</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -101,21 +101,38 @@
|
|
|
string bc_selected;
|
|
|
string fi;
|
|
|
string ti;
|
|
|
+
|
|
|
+ bool counter = false;
|
|
|
+ void cfi(string val)
|
|
|
+ {
|
|
|
+ counter = true;
|
|
|
+ fromInput = val.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
string fromInput
|
|
|
{
|
|
|
get { return fi;
|
|
|
}
|
|
|
set { fi = value;
|
|
|
- var val = System.Convert.ToSingle(fi);
|
|
|
- val *= 5;
|
|
|
- toInput = val.ToString();
|
|
|
+ if (!counter)
|
|
|
+ {
|
|
|
+ var val = System.Convert.ToSingle(fi);
|
|
|
+ val *= 5;
|
|
|
+ toInput = val.ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ counter = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
string toInput
|
|
|
{
|
|
|
get { return ti; }
|
|
|
- set { ti = value; }
|
|
|
+ set { ti = value;
|
|
|
+ var val = System.Convert.ToSingle(ti);
|
|
|
+ val /= 5;
|
|
|
+ cfi(val.ToString()); //prevent overflow
|
|
|
+ }
|
|
|
}
|
|
|
string ft;
|
|
|
string from_token_selected
|
|
@@ -147,26 +164,41 @@
|
|
|
|
|
|
@using Models;Blockchain bcMain;
|
|
|
|
|
|
- public async Task Balances()
|
|
|
- {
|
|
|
- ethBalance = await _account.GetBalance();
|
|
|
- var bc = await _account.GetSelectedBlockChain();
|
|
|
- bc_selected = bc.name;
|
|
|
- if (bc.port == 8666)
|
|
|
- tokenBalance = await bc.BalanceOf("0xe5D682717955d6C35d465A3485625C64655a04f4", _account.GetActualAddress(bc));
|
|
|
- else
|
|
|
- tokenBalance = "0";
|
|
|
- }
|
|
|
+ public async Task Balances()
|
|
|
+ {
|
|
|
+ ethBalance = await _account.GetBalance();
|
|
|
+ var bc = await _account.GetSelectedBlockChain();
|
|
|
+ bc_selected = bc.name;
|
|
|
+ if (bc.port == 8666)
|
|
|
+ tokenBalance = await bc.BalanceOf("0xe5D682717955d6C35d465A3485625C64655a04f4", _account.GetActualAddress(bc));
|
|
|
+ else
|
|
|
+ tokenBalance = "0";
|
|
|
+ }
|
|
|
|
|
|
- public async Task Open(Models.AccountModel account)
|
|
|
- {
|
|
|
- _account = account;
|
|
|
- await Balances();
|
|
|
- await JsRuntime.InvokeVoidAsync("OpenModal", elementid);
|
|
|
- }
|
|
|
+ public async Task Open(Models.AccountModel account)
|
|
|
+ {
|
|
|
+ _account = account;
|
|
|
+ await Balances();
|
|
|
+ await JsRuntime.InvokeVoidAsync("OpenModal", elementid);
|
|
|
+ }
|
|
|
|
|
|
- public void Close()
|
|
|
- {
|
|
|
- JsRuntime.InvokeVoidAsync("CloseModal", elementid);
|
|
|
- }
|
|
|
-}
|
|
|
+ public async Task Ok()
|
|
|
+ {
|
|
|
+ bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Are you sure?");
|
|
|
+ if (confirmed)
|
|
|
+ {
|
|
|
+ Console.WriteLine("true");
|
|
|
+ //run change - recalculate balances
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Console.WriteLine("false");
|
|
|
+ //cancel
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Close()
|
|
|
+ {
|
|
|
+ JsRuntime.InvokeVoidAsync("CloseModal", elementid);
|
|
|
+ }
|
|
|
+ }
|