Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
AddTextNoteViewModel.cs
1using CommunityToolkit.Mvvm.ComponentModel;
2using CommunityToolkit.Mvvm.Input;
3using Mopups.Services;
5
7{
11 public partial class AddTextNoteViewModel : BaseViewModel
12 {
13 private readonly TaskCompletionSource<bool?> result = new();
14
19 : base()
20 {
21 }
22
26 public Task<bool?> Result => this.result.Task;
27
31 [ObservableProperty]
32 [NotifyCanExecuteChangedFor(nameof(AddNoteCommand))]
33 private string? textNote;
34
38 [ObservableProperty]
39 private bool personal;
40
44 public bool CanAddNote => !string.IsNullOrEmpty(this.TextNote);
45
49 [RelayCommand(CanExecute = nameof(CanAddNote))]
50 private async Task AddNote()
51 {
52 this.result.TrySetResult(!string.IsNullOrEmpty(this.TextNote));
53 await MopupService.Instance.PopAsync();
54 }
55
59 [RelayCommand]
60 private async Task Cancel()
61 {
62 this.result.TrySetResult(false);
63 await MopupService.Instance.PopAsync();
64 }
65
69 internal void Close()
70 {
71 this.result.TrySetResult(null);
72 }
73 }
74}
A base class for all view models, inheriting from the BindableObject. NOTE: using this class requir...
View model for popup page prompting the user for a text note to be added.
Task< bool?> Result
Result will be provided here. If dialog is cancelled, null is returned.
AddTextNoteViewModel()
View model for popup page prompting the user for a text note to be added.