async void DownloadImage() { using (var httpClient = new HttpClient()) { var imageBytes = httpClient.GetByteArrayAsync(new Uri(screenshots[currentImageIndex].screenshot_url)); Screenshot.Image = UIImage.LoadFromData(NSData.FromArray(await imageBytes)); Screenshot.Transform = CGAffineTransform.MakeTranslation(0f, 0f); Screenshot.ContentMode = UIViewContentMode.ScaleAspectFit; ScreenshotSpinner.StopAnimating(); } }
void ReleaseDesignerOutlets() { if (Screenshot != null) { Screenshot.Dispose(); Screenshot = null; } if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (TweetButton != null) { TweetButton.Dispose(); TweetButton = null; } if (PostButton != null) { PostButton.Dispose(); PostButton = null; } if (ButtonSplitter != null) { ButtonSplitter.Dispose(); ButtonSplitter = null; } if (ScreenshotSpinner != null) { ScreenshotSpinner.Dispose(); ScreenshotSpinner = null; } if (PrevBtn != null) { PrevBtn.Dispose(); PrevBtn = null; } if (NextBtn != null) { NextBtn.Dispose(); NextBtn = null; } }
void SwipeImage(string direction) { UIView.Animate(0.5, 0, UIViewAnimationOptions.CurveEaseInOut, delegate { if (direction == "Right") { Screenshot.Transform = CGAffineTransform.MakeTranslation(+500f, 0f); } else { Screenshot.Transform = CGAffineTransform.MakeTranslation(-500f, 0f); } }, delegate { ScreenshotSpinner.StartAnimating(); if (direction == "Right") { currentImageIndex = currentImageIndex == screenshots.Count - 1 ? 0 : ++currentImageIndex; } else { currentImageIndex = currentImageIndex == 0 ? screenshots.Count - 1 : --currentImageIndex; } DownloadImage(); }); }