1using CommunityToolkit.Mvvm.ComponentModel;
2using CommunityToolkit.Mvvm.Input;
6using System.ComponentModel;
16 private readonly TaskCompletionSource<decimal?>? result;
17 private bool buyButtonPressed =
false;
27 this.result = Args?.
Result;
29 this.AmountText =
string.Empty;
30 this.AmountOk =
false;
36 this.result?.TrySetResult(this.buyButtonPressed ? this.Amount :
null);
38 await base.OnDispose();
41 partial
void OnAmountTextChanged(
string? value)
49 this.AmountOk =
false;
58 private decimal amount;
65 [NotifyCanExecuteChangedFor(nameof(BuyCommand))]
66 private bool amountOk;
72 private string? amountText;
77 public bool AmountEntryValid => this.AmountOk ||
string.IsNullOrEmpty(this.AmountText);
83 private string? currency;
114 [RelayCommand(CanExecute = nameof(AmountOk))]
115 private async Task Buy()
117 this.buyButtonPressed =
true;
Base class that references services in the app.
static IUiService UiService
Service serializing and managing UI-related tasks.
virtual async Task GoBack()
Method called when user wants to navigate to the previous screen.
Holds navigation parameters for the calculator.
A page that allows the user to calculate the value of a numerical input field.
Holds navigation parameters specific to buying eDaler.
TaskCompletionSource< decimal?>? Result
Amount, or null if user cancels operation.
The view model to bind to for buying eDaler.
override async Task OnDispose()
Method called when the view is disposed, and will not be used more. Use this method to unregister eve...
BuyEDalerViewModel(BuyEDalerNavigationArgs? Args)
Creates an instance of the BuyEDalerViewModel class.
async Task OpenCalculator(object Parameter)
Opens the calculator for calculating the value of a numerical property.
bool AmountEntryValid
If amount entry should show an error
A view model that holds the XMPP state.
Helps with parsing of commong data types.
static bool TryParse(string s, out double Value)
Tries to decode a string encoded double.
Task DisplayException(Exception Exception, string? Title=null)
Displays an alert/message box to the user.
Task GoToAsync(string Route, BackMethod BackMethod=BackMethod.Inherited, string? UniqueId=null)
Navigates the AppShell to the specified route, with page arguments to match.
BackMethod
Navigation Back Method
delegate string ToString(IElement Element)
Delegate for callback methods that convert an element value to a string.