1using CommunityToolkit.Mvvm.ComponentModel;
2using CommunityToolkit.Mvvm.Input;
9using System.ComponentModel;
10using System.Globalization;
33 this.Currency = Args?.
Balance?.Currency;
36 this.AmountText =
string.Empty;
37 this.AmountOk =
false;
40 this.AmountExtraText =
string.Empty;
41 this.AmountExtraOk =
false;
52 private decimal amount;
58 private bool amountOk;
64 private string? amountText;
66 protected override void OnPropertyChanged(PropertyChangedEventArgs e)
68 base.OnPropertyChanged(e);
70 switch (e.PropertyName)
72 case nameof(this.AmountText):
73 if (
CommonTypes.TryParse(this.AmountText, out decimal d) && d > 0)
79 this.AmountOk =
false;
82 case nameof(this.AmountExtraText):
83 if (string.IsNullOrEmpty(this.AmountExtraText))
85 this.AmountExtra =
null;
86 this.AmountExtraOk =
true;
91 this.AmountExtraOk =
true;
94 this.AmountExtraOk =
false;
103 private decimal? amountExtra;
109 private bool amountExtraOk;
115 private string? amountExtraText;
121 private string? currency;
127 private string? message;
133 private bool encryptMessage;
140 [RelayCommand(CanExecute = nameof(AmountOk))]
141 private Task GenerateQrCode()
148 this.Currency ??
string.Empty,
this.Message ??
string.Empty);
153 this.Currency ??
string.Empty,
this.Message ??
string.Empty);
158 MainThread.BeginInvokeOnMainThread(async () =>
160 this.GenerateQrCode(Uri);
162 await this.page.ShowQrCode();
166 return Task.CompletedTask;
172 [RelayCommand(CanExecute = nameof(HasQrCode))]
173 private async Task ShareContact()
177 TaskCompletionSource<ContactInfoModel?> Selected =
new();
189 if (
string.IsNullOrEmpty(Contact.
BareJid))
196 StringBuilder Markdown =
new();
198 Markdown.Append(
";
201 Markdown.Append(this.QrCodeUri);
202 Markdown.Append(
')');
206 if (Contact.
Contact is not
null)
208 await Task.Delay(100);
224 [RelayCommand(CanExecute = nameof(HasQrCode))]
225 private async Task ShareExternal()
227 if (this.QrCodeBin is
null)
232 string? Message = this.Message;
233 if (
string.IsNullOrEmpty(Message))
236 ServiceRef.PlatformSpecific.ShareImage(this.QrCodeBin,
string.Format(CultureInfo.CurrentCulture, Message,
this.Amount,
this.Currency),
263 case "AmountExtraText":
276 #region ILinkableView
Base class that references services in the app.
static ILogService LogService
Log service.
static IUiService UiService
Service serializing and managing UI-related tasks.
static ITagProfile TagProfile
TAG Profile service.
static IStringLocalizer Localizer
Localization service
static IXmppService XmppService
The XMPP service for XMPP communication.
bool IsAppearing
Returns true if the view model is shown.
Holds navigation parameters specific to views displaying a list of contacts.
A page that displays a list of the current user's contacts.
The view model to bind to when displaying the list of contacts.
Contact Information model, including related notification information.
ContactInfo? Contact
Contact Information object in database.
CaseInsensitiveString? BareJid
Bare JID of contact.
Holds navigation parameters specific to views displaying a list of contacts.
A page that displays a list of the current user's contacts.
Holds navigation parameters for the calculator.
A page that allows the user to calculate the value of a numerical input field.
A view model that holds the XMPP state.
void RemoveQrCode()
Removes the QR-code
Holds navigation parameters specific to an eDaler balance event.
Balance? Balance
eDaler balance object.
A page that displays information about eDaler received.
The view model to bind to for requesting a payment.
async Task OpenCalculator(object Parameter)
Opens the calculator for calculating the value of a numerical property.
override Task< string > Title
Title of the current view
RequestPaymentViewModel(RequestPaymentPage Page, EDalerBalanceNavigationArgs? Args)
The view model to bind to for requesting a payment.
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.
Task< bool > DisplayAlert(string Title, string Message, string? Accept=null, string? Cancel=null)
Displays an alert/message box to the user.
BackMethod
Navigation Back Method
delegate string ToString(IElement Element)
Delegate for callback methods that convert an element value to a string.