public override IEnumerator OnAlert(Exception ex) { WebAPIException exception = ex as WebAPIException; APIAlert apiAlert = new APIAlert(); if (!exception.IsBackTopScreenError()) { bool isDisplayRetryButton = this.isRequestRetry; if (APIUtil.Instance().alertOnlyCloseButton) { isDisplayRetryButton = false; } apiAlert.NetworkAPIError(exception, isDisplayRetryButton); while (apiAlert.IsOpen()) { yield return(null); } if (apiAlert.SelectedRetryButton) { this.requestStatus = WebAPI.RequestStatus.RETRY; this.afterAlertClosedBehavior = TaskBase.AfterAlertClosed.RETRY; } else { this.afterAlertClosedBehavior = TaskBase.AfterAlertClosed.RETURN; } yield break; } apiAlert.NetworkAPIException(exception); for (;;) { yield return(null); } }
public IEnumerator OAuthLogin(Action <string> onCompleted) { string result = null; Action onSuccess = delegate() { result = "Success"; }; WebAPIException exception = null; Action <WebAPIException> onException = delegate(WebAPIException ex) { exception = ex; result = "Failed"; }; this.AuthStart(onSuccess, onException); while (string.IsNullOrEmpty(result)) { yield return(null); } if ("Success" == result) { onCompleted(result); } else if (exception != null) { APIAlert apialert = new APIAlert(); if (!exception.IsBackTopScreenError()) { RestrictionInput.SuspensionLoad(); apialert.NetworkAPIError(exception, true); apialert.ClosedAction = delegate() { RestrictionInput.ResumeLoad(); onCompleted(result); }; } else { apialert.NetworkAPIException(exception); } } else { string @string = StringMaster.GetString("AuthFailedTitle"); string string2 = StringMaster.GetString("AuthFailedInfo"); Action <int> action = delegate(int nop) { RestrictionInput.ResumeLoad(); onCompleted(result); }; RestrictionInput.SuspensionLoad(); AlertManager.ShowAlertDialog(action, @string, string2, AlertManager.ButtonActionType.Retry, false); } yield break; }