Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MainViewModel.cs
1using System.ComponentModel;
2using CommunityToolkit.Mvvm.Input;
6
8{
9 public partial class MainViewModel : QrXmppViewModel
10 {
11 public MainViewModel()
12 : base()
13 {
14 }
15
16 public override Task<string> Title => Task.FromResult(ContactInfo.GetFriendlyName(ServiceRef.TagProfile.LegalIdentity));
17
18 protected override void OnPropertyChanged(PropertyChangedEventArgs e)
19 {
20 base.OnPropertyChanged(e);
21
22 switch (e.PropertyName)
23 {
24 case nameof(this.IsConnected):
25 this.ScanQrCodeCommand.NotifyCanExecuteChanged();
26 break;
27 }
28 }
29
30 public bool CanScanQrCode => this.IsConnected;
31
32 [RelayCommand(CanExecute = nameof(CanScanQrCode))]
33 private async Task ScanQrCode()
34 {
35 await Services.UI.QR.QrCode.ScanQrCodeAndHandleResult();
36 }
37
38 [RelayCommand]
39 public static async Task ViewId()
40 {
41 try
42 {
44 await ServiceRef.UiService.GoToAsync(nameof(ViewIdentityPage));
45 }
46 catch (Exception ex)
47 {
48 ServiceRef.LogService.LogException(ex);
49 }
50 }
51 }
52}
The Application class, representing an instance of the Neuro-Access app.
Definition: App.xaml.cs:69
static Task< bool > AuthenticateUser(AuthenticationPurpose Purpose, bool Force=false)
Authenticates the user using the configured authentication method.
Definition: App.xaml.cs:981
Contains information about a contact.
Definition: ContactInfo.cs:21
static async Task< string > GetFriendlyName(CaseInsensitiveString RemoteId)
Gets the friendly name of a remote identity (Legal ID or Bare JID).
Definition: ContactInfo.cs:257
Base class that references services in the app.
Definition: ServiceRef.cs:31
static ILogService LogService
Log service.
Definition: ServiceRef.cs:91
static IUiService UiService
Service serializing and managing UI-related tasks.
Definition: ServiceRef.cs:55
static ITagProfile TagProfile
TAG Profile service.
Definition: ServiceRef.cs:79
A page to display when the user wants to view an identity.
override Task< string > Title
Title of the current view
A view model that holds the XMPP state.
AuthenticationPurpose
Purpose for requesting the user to authenticate itself.