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 DismissWorker()
        {
            SetFadeoutTimer(null);
            SetProgressTimer(null);

            UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn | UIViewAnimationOptions.AllowUserInteraction,
                           delegate {
                HudView.Transform.Scale(0.8f, 0.8f);
                if (isClear)
                {
                    HudView.Alpha = 0f;
                }
                else
                {
                    Alpha = 0f;
                }
            }, delegate {
                if (Alpha == 0f || HudView.Alpha == 0f)
                {
                    InvokeOnMainThread(delegate {
                        Alpha         = 0f;
                        HudView.Alpha = 0f;

                        //Removing observers
                        UnRegisterNotifications();
                        NSNotificationCenter.DefaultCenter.RemoveObserver(this);

                        Ring.ResetStyle(UIColor.White);

                        CancelRingLayerAnimation();
                        StringLabel.RemoveFromSuperview();
                        SpinnerView.RemoveFromSuperview();
                        ImageView.RemoveFromSuperview();
                        if (_cancelHud != null)
                        {
                            _cancelHud.RemoveFromSuperview();
                        }

                        StringLabel = null;
                        SpinnerView = null;
                        ImageView   = null;
                        _cancelHud  = null;

                        HudView.RemoveFromSuperview();
                        HudView = null;
                        OverlayView.RemoveFromSuperview();
                        OverlayView = null;
                        this.RemoveFromSuperview();
                    });
                }
            });
        }
Exemple #3
0
        void DismissWorker()
        {
            SetFadeoutTimer(null);
            SetProgressTimer(null);

            UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn | UIViewAnimationOptions.AllowUserInteraction,
                           delegate
            {
                HudView.Transform.Scale(0.8f, 0.8f);
                if (isClear)
                {
                    HudView.Alpha = 0f;
                }
                else
                {
                    Alpha = 0f;
                }
            }, delegate
            {
                if (Alpha == 0f || HudView.Alpha == 0f)
                {
                    InvokeOnMainThread(delegate
                    {
                        Alpha         = 0f;
                        HudView.Alpha = 0f;

                        //Removing observers
                        UnRegisterNotifications();
                        NSNotificationCenter.DefaultCenter.RemoveObserver(this);

                        Ring.ResetStyle(IsiOS7ForLookAndFeel, (IsiOS7ForLookAndFeel ? TintColor : UIColor.White));

                        CancelRingLayerAnimation();
                        StringLabel.RemoveFromSuperview();
                        SpinnerView.RemoveFromSuperview();
                        ImageView.RemoveFromSuperview();
                        if (_cancelHud != null)
                        {
                            _cancelHud.RemoveFromSuperview();
                        }

                        StringLabel = null;
                        SpinnerView = null;
                        ImageView   = null;
                        _cancelHud  = null;

                        HudView.RemoveFromSuperview();
                        HudView = null;
                        OverlayView.RemoveFromSuperview();
                        OverlayView = null;
                        this.RemoveFromSuperview();

                        if (IsiOS7ForLookAndFeel)
                        {
                            var rootController = UIApplication.SharedApplication.GetKeyWindow().RootViewController;
                            if (rootController != null)
                            {
                                rootController.SetNeedsStatusBarAppearanceUpdate();
                            }
                        }
                    });
                }
            });
        }