internal async Task ShowPhotoResult(PhotoResult result)
        {
            var imageVM = new FeedbackImageVM(this.ParentVM);

            imageVM.IsEditable = true;
            byte[] imageBytes = null;
            if (Path.GetExtension(result.OriginalFileName).ToLower().EndsWith("jpg"))
            {
                BitmapImage img = new BitmapImage();
                img.SetSource(result.ChosenPhoto);
                var wbBitmap = new WriteableBitmap(img);
                using (var stream = new MemoryStream())
                {
                    wbBitmap.WritePNG(stream);
                    stream.Seek(0, System.IO.SeekOrigin.Begin);
                    imageBytes = new byte[stream.Length];
                    stream.Read(imageBytes, 0, (int)stream.Length);
                }
            }
            else //png
            {
                imageBytes = new byte[result.ChosenPhoto.Length];
                await result.ChosenPhoto.ReadAsync(imageBytes, 0, (int)result.ChosenPhoto.Length);
            }
            imageVM.FeedbackImage = new FeedbackAttachment(Path.GetFileName(result.OriginalFileName), imageBytes, null);
            Attachments.Add(imageVM);
            this.ParentVM.SwitchToImageEditor(imageVM);
        }
 internal void SwitchToImageEditor(FeedbackImageVM imageVM)
 {
     CurrentImageVM = imageVM;
     if (imageVM.IsEditable)
     {
         switchViewStateAction(FeedbackViewState.ImageEdit);
     }
     else
     {
         switchViewStateAction(FeedbackViewState.ImageShow);
     }
 }
 internal async Task ShowPhotoResult(PhotoResult result)
 {
     var imageVM = new FeedbackImageVM(this.ParentVM);
     imageVM.IsEditable = true;
     byte[] imageBytes = null;
     if (Path.GetExtension(result.OriginalFileName).ToLower().EndsWith("jpg"))
     {
         BitmapImage img = new BitmapImage();
         img.SetSource(result.ChosenPhoto);
         var wbBitmap = new WriteableBitmap(img);
         using (var stream = new MemoryStream())
         {
             wbBitmap.WritePNG(stream);
             stream.Seek(0, System.IO.SeekOrigin.Begin);
             imageBytes = new byte[stream.Length];
             stream.Read(imageBytes, 0, (int)stream.Length);
         }
     }
     else //png
     {
         imageBytes = new byte[result.ChosenPhoto.Length];
         await result.ChosenPhoto.ReadAsync(imageBytes, 0, (int)result.ChosenPhoto.Length);
     }
     imageVM.FeedbackImage = new FeedbackAttachment(Path.GetFileName(result.OriginalFileName), imageBytes, null);
     Attachments.Add(imageVM);
     this.ParentVM.SwitchToImageEditor(imageVM);
 }
 public void RemoveAttachment(FeedbackImageVM attachment)
 {
     this.Attachments.Remove(attachment);
 }
 public void AddAttachment(FeedbackImageVM attachment)
 {
     this.Attachments.Add(attachment);
 }
 internal void SwitchToImageEditor(FeedbackImageVM imageVM)
 {
     CurrentImageVM = imageVM;
     if (imageVM.IsEditable)
     {
         switchViewStateAction(FeedbackViewState.ImageEdit);
     }
     else
     {
         switchViewStateAction(FeedbackViewState.ImageShow);
     }
 }
 public void RemoveAttachment(FeedbackImageVM attachment)
 {
     this.Attachments.Remove(attachment);
 }
 public void AddAttachment(FeedbackImageVM attachment)
 {
     this.Attachments.Add(attachment);
 }