Skip to content
Permalink
Browse files

[skip ci] Improve error and success messages and make them disappear …

…after 7 seconds.
  • Loading branch information...
nopara73 committed Nov 10, 2018
1 parent 29a2693 commit 7736f89d5297af36062d455bd9e9f6d8cd40b4ed
Showing with 30 additions and 2 deletions.
  1. +30 −2 WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -108,15 +108,25 @@ public SendTabViewModel(WalletViewModel walletViewModel)
return;
}

var address = BitcoinAddress.Create(Address.Trim(), Global.Network);
BitcoinAddress address;
try
{
address = BitcoinAddress.Create(Address.Trim(), Global.Network);
}
catch (FormatException)
{
SetWarningMessage("Invalid address.");
return;
}

var script = address.ScriptPubKey;
var amount = Money.Zero;
if (!IsMax)
{
amount = Money.Parse(Amount);
if (amount == Money.Zero)
{
SetWarningMessage($"Invalid {nameof(Amount)}");
SetWarningMessage($"Invalid amount.");
return;
}
}
@@ -184,12 +194,30 @@ private void SetWarningMessage(string message)
{
SuccessMessage = "";
WarningMessage = message;

Dispatcher.UIThread.Post(async () =>
{
await Task.Delay(7000);
if (WarningMessage == message)
{
WarningMessage = "";
}
});
}

private void SetSuccessMessage(string message)
{
SuccessMessage = message;
WarningMessage = "";

Dispatcher.UIThread.Post(async () =>
{
await Task.Delay(7000);
if (SuccessMessage == message)
{
SuccessMessage = "";
}
});
}

private void SetMax()

0 comments on commit 7736f89

Please sign in to comment.
You can’t perform that action at this time.