예제 #1
0
        private async void PictureButton_OnClicked(object sender, EventArgs e)
        {
            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsPickPhotoSupported)
            {
                await DisplayAlert("No Camera", "No Camera Availible", "OK");

                return;
            }

            var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions()
            {
                AllowCropping = true, CompressionQuality = 5, CustomPhotoSize = 90
            });


            if (file == null)
            {
                return;
            }


            var picture = file.GetStream();



            //case:Edit
            Attendance.AddStudentPhoto(id, picture);


            //Label path = new Label { Text = file.AlbumPath };

            Picture.Source = ImageSource.FromStream(() =>
            {
                var stream = picture;
                return(stream);
            });
        }