-
Notifications
You must be signed in to change notification settings - Fork 13
/
CameraPage.cs
47 lines (38 loc) · 975 Bytes
/
CameraPage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.IO;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace FullCameraPage
{
public class CameraPage : ContentPage
{
public delegate void PhotoResultEventHandler(PhotoResultEventArgs result);
public event PhotoResultEventHandler OnPhotoResult;
public void SetPhotoResult(byte[] image, int width = -1, int height = -1)
{
OnPhotoResult?.Invoke(new PhotoResultEventArgs(image, width, height));
}
public void Cancel()
{
OnPhotoResult?.Invoke(new PhotoResultEventArgs());
}
}
public class PhotoResultEventArgs : EventArgs
{
public PhotoResultEventArgs()
{
Success = false;
}
public PhotoResultEventArgs(byte[] image, int width, int height)
{
Success = true;
Image = image;
Width = width;
Height = height;
}
public byte[] Image { get; private set; }
public int Width { get; private set; }
public int Height { get; private set; }
public bool Success { get; private set; }
}
}