private async void Crop_Click(object sender, RoutedEventArgs e)
        {
            #region File Setup
            // Load a File Picker that shows image file types
            FileOpenPicker open = new FileOpenPicker();
            open.FileTypeFilter.Add(".jpg");
            open.FileTypeFilter.Add(".png");
            open.FileTypeFilter.Add(".jpeg");
            open.ViewMode = PickerViewMode.Thumbnail;
            open.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            open.CommitButtonText       = "Open";

            // Wait for user to select a file
            StorageFile source = await open.PickSingleFileAsync();

            // Verify the source is not null
            if (source != null)
            {
                try
                {
                    // Create a destination file
                    StorageFile dest = await KnownFolders.PicturesLibrary.CreateFileAsync("Cropped.jpg", CreationCollisionOption.ReplaceExisting);

                    #endregion

                    // Call CropImageAsync and receive Result
                    LaunchUriResult result = await this.CropImageAsync(source, dest, 500, 500);

                    // Load Destination Image into Image Preview
                    var stream = await dest.OpenReadAsync();

                    await AppData.currentImage.SetSourceAsync(stream);

                    #region Error Handling
                    // Verify result and load picture into the source
                    if (result.Status == LaunchUriStatus.Success && result.Result != null)
                    {
                        string imgstr = await ImageTools.FileToString(dest);

                        if (imgstr != null)
                        {
                            await AppData.currentImage.SetSourceAsync(ImageTools.DecodeStringToBitmapSource(imgstr));

                            AppData.currentImageString = imgstr;
                        }
                    }
                }
                catch
                {
                    MessageDialog md = new MessageDialog("Error loading image file.");
                    await md.ShowAsync();
                }
            }
            #endregion
        }
        // open image button
        private async void Open_Click(object sender, RoutedEventArgs e)
        {
            // open file
            FileOpenPicker open = new FileOpenPicker();

            open.FileTypeFilter.Add(".jpg");
            open.FileTypeFilter.Add(".png");
            open.FileTypeFilter.Add(".jpeg");
            open.ViewMode = PickerViewMode.Thumbnail;
            open.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            open.CommitButtonText       = "Open";

            // Open a stream for the selected file
            StorageFile file = await open.PickSingleFileAsync();

            // load the file as the image
            if (file != null)
            {
                try
                {
                    string imgstr = await ImageTools.FileToString(file);

                    if (imgstr != null)
                    {
                        await AppData.currentImage.SetSourceAsync(ImageTools.DecodeStringToBitmapSource(imgstr));

                        AppData.currentImageString = imgstr;
                    }
                }
                catch
                {
                    MessageDialog md = new MessageDialog("Error loading image file.");
                    await md.ShowAsync();
                }
            }
        }