Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ImageViewModel.cs
1using CommunityToolkit.Mvvm.ComponentModel;
4using System.Collections.ObjectModel;
6
8{
12 public partial class ImageViewModel : BaseViewModel
13 {
14 private readonly PhotosLoader photosLoader;
15
20 {
21 this.Photos = [];
22 this.photosLoader = new PhotosLoader(this.Photos);
23 }
24
28 public ObservableCollection<Photo> Photos { get; }
29
33 [ObservableProperty]
34 private bool isSwipeEnabled;
35
40 public void LoadPhotos(Attachment[] attachments)
41 {
42 this.photosLoader.CancelLoadPhotos();
43 this.IsSwipeEnabled = false;
44
45 _ = this.photosLoader.LoadPhotos(attachments, SignWith.LatestApprovedIdOrCurrentKeys, () =>
46 {
47 MainThread.BeginInvokeOnMainThread(() => this.IsSwipeEnabled = this.Photos.Count > 1);
48 });
49 }
50
54 public void ClearPhotos()
55 {
56 this.photosLoader.CancelLoadPhotos();
57 }
58 }
59}
A base class for all view models, inheriting from the BindableObject. NOTE: using this class requir...
The class to use as binding context for displaying images.
void LoadPhotos(Attachment[] attachments)
Loads the attachments photos, if there are any.
ImageViewModel()
Creates a new instance of the ImageViewModel class.
ObservableCollection< Photo > Photos
Holds the list of photos to display.
void ClearPhotos()
Clears the currently displayed photos.
Contains a reference to an attachment assigned to a legal object.
Definition: Attachment.cs:9
SignWith
Options on what keys to use when signing data.
Definition: Enumerations.cs:84