Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ImageView.xaml.cs
3
5{
9 [XamlCompilation(XamlCompilationOptions.Compile)]
10 public partial class ImageView
11 {
12 private const uint durationInMs = 300;
13
17 public ImageView()
18 {
19 this.InitializeComponent();
20 this.ContentPageModel = new ImageViewModel();
21 }
22
27 public void ShowPhotos(Attachment[] attachments)
28 {
29 if (attachments is null || attachments.Length <= 0)
30 return;
31
32 Attachment[] imageAttachments = attachments.GetImageAttachments().ToArray();
33 if (imageAttachments.Length <= 0)
34 return;
35
36 this.IsVisible = true;
37
38 this.ViewModel<ImageViewModel>().LoadPhotos(attachments);
39 MainThread.BeginInvokeOnMainThread(async () =>
40 {
41 await this.PhotoViewer.FadeTo(1d, durationInMs, Easing.SinIn);
42 });
43 }
44
48 public void HidePhotos()
49 {
50 this.PhotoViewer.Opacity = 0;
51 this.ViewModel<ImageViewModel>().ClearPhotos();
52 this.IsVisible = false;
53 }
54
55 private void CloseIcon_Tapped(object Sender, EventArgs e)
56 {
57 this.HidePhotos();
58 }
59
64 public bool PhotosAreShowing()
65 {
66 return this.PhotoViewer.Opacity > 0 && this.IsVisible;
67 }
68 }
69}
A generic UI component to display an image.
ImageView()
Creates a new instance of the ImageView class.
void HidePhotos()
Hides the photos from view.
bool PhotosAreShowing()
Gets if photos are showing or not.
void ShowPhotos(Attachment[] attachments)
Shows the attachments photos in the current view.
The class to use as binding context for displaying images.
Contains a reference to an attachment assigned to a legal object.
Definition: Attachment.cs:9