Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SubscribeToViewModel.cs
1using CommunityToolkit.Mvvm.ComponentModel;
2using CommunityToolkit.Mvvm.Input;
5
7{
11 public partial class SubscribeToViewModel : BaseViewModel
12 {
13 private readonly TaskCompletionSource<bool?> result = new();
14
19 public SubscribeToViewModel(string BareJid)
20 : base()
21 {
22 this.BareJid = BareJid;
23 }
24
28 [ObservableProperty]
29 private string bareJid;
30
34 public Task<bool?> Result => this.result.Task;
35
39 [RelayCommand]
40 private async Task Confirm()
41 {
42 this.result.TrySetResult(true);
43 await ServiceRef.PopupService.PopAsync();
44 }
45
49 [RelayCommand]
50 private async Task Decline()
51 {
52 this.result.TrySetResult(false);
53 await ServiceRef.PopupService.PopAsync();
54 }
55
56 [RelayCommand]
57 private async Task Cancel()
58 {
59 this.result.TrySetResult(null);
60 await ServiceRef.PopupService.PopAsync();
61 }
62
66 internal void Close()
67 {
68 this.result.TrySetResult(null);
69 }
70 }
71}
Base class that references services in the app.
Definition: ServiceRef.cs:43
static IPopupService PopupService
Popup service for presenting application popups.
Definition: ServiceRef.cs:142
A base class for all view models, inheriting from the BindableObject. NOTE: using this class requir...
SubscribeToViewModel(string BareJid)
View model for SubscribeToPopup
Task< bool?> Result
Result will be provided here. If dialog is cancelled, null is returned.