Ejemplo n.º 1
0
        private async void EditPhoto_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var picker = new FileOpenPicker();
                picker.ViewMode = PickerViewMode.Thumbnail;
                picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                picker.FileTypeFilter.AddRange(Constants.MediaTypes);

                var media = await picker.PickSingleMediaAsync();

                if (media != null)
                {
                    var dialog = new EditMediaPopup(media, ImageCropperMask.Ellipse);

                    var confirm = await dialog.ShowAsync();

                    if (confirm == ContentDialogResult.Primary)
                    {
                        ViewModel.EditPhotoCommand.Execute(media);
                    }
                }
            }
            catch { }
        }
Ejemplo n.º 2
0
        private async void EditCamera_Click(object sender, RoutedEventArgs e)
        {
            var capture = new CameraCaptureUI();

            capture.VideoSettings.AllowTrimming        = true;
            capture.VideoSettings.Format               = CameraCaptureUIVideoFormat.Mp4;
            capture.VideoSettings.MaxResolution        = CameraCaptureUIMaxVideoResolution.StandardDefinition;
            capture.VideoSettings.MaxDurationInSeconds = 9f;
            capture.PhotoSettings.AllowCropping        = true;
            capture.PhotoSettings.Format               = CameraCaptureUIPhotoFormat.Jpeg;
            capture.PhotoSettings.MaxResolution        = CameraCaptureUIMaxPhotoResolution.HighestAvailable;

            var file = await capture.CaptureFileAsync(CameraCaptureUIMode.PhotoOrVideo);

            if (file != null)
            {
                var media = await StorageMedia.CreateAsync(file);

                var dialog = new EditMediaPopup(media, ImageCropperMask.Ellipse);

                var confirm = await dialog.ShowAsync();

                if (confirm == ContentDialogResult.Primary)
                {
                    ViewModel.EditPhotoCommand.Execute(media);
                }
            }
        }
Ejemplo n.º 3
0
        private async void EditCamera_Click(object sender, RoutedEventArgs e)
        {
            var capture = new CameraCaptureUI();

            capture.PhotoSettings.AllowCropping = false;
            capture.PhotoSettings.Format        = CameraCaptureUIPhotoFormat.Jpeg;
            capture.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.HighestAvailable;

            var file = await capture.CaptureFileAsync(CameraCaptureUIMode.Photo);

            if (file != null)
            {
                var dialog = new EditMediaPopup(file, BitmapProportions.Square, ImageCropperMask.Ellipse);

                var confirm = await dialog.ShowAsync();

                if (confirm == ContentDialogResult.Primary && dialog.Result != null)
                {
                    ViewModel.EditPhotoCommand.Execute(dialog.Result);
                }
            }
        }
Ejemplo n.º 4
0
        private async void EditPhoto_Click(object sender, RoutedEventArgs e)
        {
            var picker = new FileOpenPicker();

            picker.ViewMode = PickerViewMode.Thumbnail;
            picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            picker.FileTypeFilter.AddRange(Constants.PhotoTypes);

            var file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                var dialog = new EditMediaPopup(file, BitmapProportions.Square, ImageCropperMask.Ellipse);

                var confirm = await dialog.ShowAsync();

                if (confirm == ContentDialogResult.Primary && dialog.Result != null)
                {
                    ViewModel.EditPhotoCommand.Execute(dialog.Result);
                }
            }
        }