1using CommunityToolkit.Mvvm.ComponentModel;
2using CommunityToolkit.Mvvm.Input;
5using System.Collections.ObjectModel;
18 private bool responseSent;
31 this.form = Args.Form;
32 this.responseSent =
false;
36 this.Title = this.form?.Title ??
string.Empty;
37 this.Instructions = this.form?.Instructions ?? [];
39 if (this.form?.HasPages ??
false)
41 foreach (Layout.Page P in
this.form.Pages)
45 this.MultiplePages = this.form.Pages.Length > 1;
49 List<Layout.LayoutElement> Elements = [];
51 foreach (
Field F
in this.form?.Fields ?? [])
56 Elements.Add(
new Layout.FieldReference(
this.form, F.Var));
59 this.
Pages.Add(
new PageModel(
this,
new Layout.Page(
this.form,
string.Empty, Elements.ToArray())));
61 this.MultiplePages =
false;
71 if (this.form is not
null && this.form.CanCancel && !
this.responseSent)
74 this.responseSent =
true;
77 await base.OnDispose();
86 private string? title;
92 private string[]? instructions;
97 public ObservableCollection<PageModel>
Pages {
get; }
103 private bool isFormOk;
109 private bool multiplePages;
119 private async Task Submit()
126 if (this.form is not
null && this.form.CanSubmit && !
this.responseSent)
129 this.responseSent =
true;
140 internal void ValidateForm()
144 foreach (
Field F
in this.form?.Fields ?? [])
148 this.IsFormOk =
false;
153 this.IsFormOk =
true;
157 this.IsFormOk =
false;
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.
The view model to bind to for when displaying the calculator.
ObservableCollection< PageModel > Pages
Holds the pages of the form
XmppFormViewModel(XmppFormNavigationArgs? Args)
Creates an instance of the XmppFormViewModel class.
override async Task OnDispose()
Method called when the view is disposed, and will not be used more. Use this method to unregister eve...
A view model that holds the XMPP state.