|
4 | 4 |
|
5 | 5 | <MudPaper Class="pa-8">
|
6 | 6 | <MudStack Spacing="2">
|
7 |
| - <MudTextField @bind-Value="Wallet.Address" ReadOnly="@IsReadOnly" Required="true" RequiredError="Input a wallet address" Mask="@(new RegexMask("^[a-zA-Z0-9_\\-]{0,43}$"))" Label="Wallet Address" Variant="Variant.Text"></MudTextField> |
| 7 | + <MudTextField @bind-Value="Address" ReadOnly="@IsReadOnly" Required="true" RequiredError="Input a wallet address" Mask="@(new RegexMask("^[a-zA-Z0-9_\\-]{0,43}$"))" Label="Wallet Address" Variant="Variant.Text"></MudTextField> |
8 | 8 | <MudText Color="Color.Secondary">@Progress</MudText>
|
9 |
| - <MudTextField @bind-Value="Wallet.Name" Label="Wallet Name" Variant="Variant.Text"></MudTextField> |
| 9 | + <MudTextField @bind-Value="Name" Label="Wallet Name" Variant="Variant.Text"></MudTextField> |
10 | 10 |
|
11 | 11 | <div Class="d-w-100 d-flex justify-end mt-2">
|
12 | 12 | <MudButton OnClick="Submit" Color="Color.Primary" Variant="Variant.Filled">
|
|
25 | 25 | [CascadingParameter] MudDialogInstance? MudDialog { get; set; }
|
26 | 26 |
|
27 | 27 | public string? Progress { get; set; }
|
| 28 | + public string Address { get; set; } = string.Empty; |
| 29 | + public string? Name { get; set; } |
28 | 30 |
|
29 |
| - public bool IsReadOnly => !Wallet.IsReadOnly; |
| 31 | + public bool IsReadOnly => !string.IsNullOrEmpty(Wallet.Address); |
30 | 32 |
|
31 | 33 |
|
| 34 | + protected override void OnParametersSet() |
| 35 | + { |
| 36 | + Address = Wallet.Address; |
| 37 | + Name = Wallet.Name; |
| 38 | + |
| 39 | + base.OnParametersSet(); |
| 40 | + } |
| 41 | + |
32 | 42 | protected override void OnInitialized()
|
33 | 43 | {
|
34 | 44 | base.OnInitialized();
|
|
44 | 54 | // return false;
|
45 | 55 | // }
|
46 | 56 |
|
47 |
| - if (string.IsNullOrWhiteSpace(Wallet.Address) || Wallet.Address.Length != 43) |
| 57 | + if (string.IsNullOrWhiteSpace(Address) || Address.Length != 43) |
48 | 58 | {
|
49 | 59 | Progress = "Length must be 43 characters.";
|
50 | 60 | StateHasChanged();
|
51 | 61 | return false;
|
52 | 62 | }
|
53 | 63 |
|
| 64 | + Wallet.Name = Name; |
| 65 | + Wallet.Address = Address; |
| 66 | + |
54 | 67 | await BindingContext.SaveWallet(Wallet);
|
55 | 68 |
|
56 |
| - Snackbar.Add($"Address saved ({Wallet.Address})", Severity.Info); |
| 69 | + StateHasChanged(); |
| 70 | + |
| 71 | + Snackbar.Add($"Address saved {Wallet.Name} ({Wallet.Address})", Severity.Info); |
57 | 72 |
|
58 | 73 | MudDialog?.Close(true);
|
59 | 74 |
|
|
0 commit comments