public void Show() { _OldKeyWindow = UIApplication.SharedApplication.KeyWindow; if (!SharedQueue.Contains(this)) { SharedQueue.Add(this); } if (IsAnimating) { return; // wait for next turn } if (_IsVisible) { return; } if (CurrentAlertView != null && CurrentAlertView.IsVisible) { SIAlertView alert = CurrentAlertView; alert.DismissAnimated(true, false); return; } if (UseMotionEffects) { ApplyMotionEffects (); } if (this.WillShowHandler != null) { this.WillShowHandler.Invoke(this); } NSNotificationCenter.DefaultCenter.PostNotificationName(Constants.SIAlertViewWillShowNotification, this, null); this._IsVisible = true; SetAnimating(true); SetCurrentAlertView(this); // transition background this.ShowBackground(); SIAlertVIewController viewController = new SIAlertVIewController(); viewController.AlertView = this; if (this._AlertWindow == null) { UIWindow window = new UIWindow(UIScreen.MainScreen.Bounds); window.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; window.Opaque = false; window.WindowLevel = Constants.UIWindowLevelSIAlert; window.RootViewController = viewController; this._AlertWindow = window; } this._AlertWindow.MakeKeyAndVisible(); this.ValidateLayout(); this.TransitionInCompletion(() => { if (this.DidShowHandler != null) { this.DidShowHandler.Invoke(this); } NSNotificationCenter.DefaultCenter.PostNotificationName(Constants.SIAlertViewDidShowNotification, this, null); SetAnimating(false); int index = SharedQueue.IndexOf(this); if (index < SharedQueue.Count - 1) { this.DismissAnimated(true, false); } }); }
public void Show() { _OldKeyWindow = UIApplication.SharedApplication.KeyWindow; if (!SharedQueue.Contains(this)) { SharedQueue.Add(this); } if (IsAnimating) { return; // wait for next turn } if (_IsVisible) { return; } if (CurrentAlertView != null && CurrentAlertView.IsVisible) { SIAlertView alert = CurrentAlertView; alert.DismissAnimated(true, false); return; } if (this.WillShowHandler != null) { this.WillShowHandler.Invoke(this); } NSNotificationCenter.DefaultCenter.PostNotificationName(Constants.SIAlertViewWillShowNotification, this, null); this._IsVisible = true; SetAnimating(true); SetCurrentAlertView(this); // transition background this.ShowBackground(); SIAlertVIewController viewController = new SIAlertVIewController(); viewController.AlertView = this; if (this._AlertWindow == null) { UIWindow window = new UIWindow(UIScreen.MainScreen.Bounds); window.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; window.Opaque = false; window.WindowLevel = Constants.UIWindowLevelSIAlert; window.RootViewController = viewController; this._AlertWindow = window; } this._AlertWindow.MakeKeyAndVisible(); this.ValidateLayout(); this.TransitionInCompletion(() => { if (this.DidShowHandler != null) { this.DidShowHandler.Invoke(this); } NSNotificationCenter.DefaultCenter.PostNotificationName(Constants.SIAlertViewDidShowNotification, this, null); SetAnimating(false); int index = SharedQueue.IndexOf(this); if (index < SharedQueue.Count - 1) { this.DismissAnimated(true, false); } }); }