Exemple #1
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            var picker = new FileSavePicker
            {
                SuggestedStartLocation = PickerLocationId.PicturesLibrary,
                SuggestedFileName      = "Crop_Image"
            };

            picker.FileTypeChoices.Add("Png Picture", new List <string> {
                ".png", ".jpg"
            });
            var file = await picker.PickSaveFileAsync();

            if (file != null)
            {
                if (file.Name.Contains(".png"))
                {
                    await ImageCropper.SaveCroppedBitmapAsync(file, BitmapEncoder.PngEncoderId);
                }
                else
                {
                    await ImageCropper.SaveCroppedBitmapAsync(file, BitmapEncoder.JpegEncoderId);
                }
            }
        }