void DismissWorker() { SetFadeoutTimer(null); UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn | UIViewAnimationOptions.AllowUserInteraction, delegate { HudView.Transform.Scale(0.8f, 0.8f); this.Alpha = 0; }, delegate { if (Alpha == 0) { InvokeOnMainThread(delegate { NSNotificationCenter.DefaultCenter.RemoveObserver(this); CancelRingLayerAnimation(); StringLabel.RemoveFromSuperview(); SpinnerView.RemoveFromSuperview(); ImageView.RemoveFromSuperview(); CancelHudButton.RemoveFromSuperview(); StringLabel = null; SpinnerView = null; ImageView = null; CancelHudButton = null; HudView.RemoveFromSuperview(); HudView = null; OverlayView.RemoveFromSuperview(); OverlayView = null; this.RemoveFromSuperview(); }); } }); }
void ShowImageWorker(UIImage image, string status, TimeSpan duration) { _progress = -1; CancelRingLayerAnimation(); //this should happen when Dismiss is called, but it happens AFTER the animation ends // so sometimes, the cancel button is left on :( if (CancelHudButton != null) { CancelHudButton.RemoveFromSuperview(); CancelHudButton = null; } if (!IsVisible) { Show(); } ImageView.Image = image; ImageView.Hidden = false; StringLabel.Text = status; UpdatePosition(); SpinnerView.StopAnimating(); StartDismissTimer(duration); }