AuraPhotoViewer.Modules.Views.ContentAndNavigation.ViewModel.ContentAndNavigationViewModel.SaveImage C# (CSharp) Method

SaveImage() private method

private SaveImage ( ) : Task
return Task
        private async Task SaveImage()
        {
            if (SelectedImage.Angle != 0)
            {
                Picture img = new Picture {ImageUri = SelectedImage.ImageUri, Angle = SelectedImage.Angle};
                int imgPos = ThumbnailCollection.View.CurrentPosition;
                IsImageSaving = true;
                await _imageProvider.SaveImageAsync(img.ImageUri, img.Angle);
                IsImageSaving = false;
                _thumbnailCollection.RemoveAt(imgPos);
                // delay to reclaim the deleted image memory
                await Task.Delay(2);
                _thumbnailCollection.Insert(imgPos, new Thumbnail { ImageUri = img.ImageUri });
                Thumbnail selectedThumbnail =
                    _thumbnailCollection.First(thumbnail => thumbnail.ImageUri == img.ImageUri);
                ThumbnailCollection.View.MoveCurrentTo(selectedThumbnail);
            }
        }