コード例 #1
0
		public async void ShowInfo(CustomerResponse cr, Boolean Continue)
		{
			BTProgressHUD.Show("Please wait...");
			CGSize sTemp = new CGSize(View.Frame.Width, 100);
			try
			{
				if (CardNumber != null)
				{
					CurrentUser.PutCardNumber(CardNumber);
				}
				if (cr != null)
				{

					if (cr.customer.Email != "" && cr.customer.Email != null)
					{
						if ((cr.ErrorDescription == null && cr.ErrorDescription == "") || cr.customer.CustomerID != 0)
						{
							lblInfo.Text = "Hi " + cr.customer.FirstName + " " +
								cr.customer.LastName + ",\nWe have sent you a verification link to "
								+ cr.customer.Email + ". Please click on the activation link to activate the account.";
						}
						else
						{
							lblInfo.Text = cr.ErrorDescription;
						}
						lblInfo.LineBreakMode = UILineBreakMode.WordWrap;
						lblInfo.Lines = 0;
						sTemp = lblInfo.SizeThatFits(sTemp);
						//Console.WriteLine("Show info "+y);
						lblInfo.Frame = new CGRect(10, y, View.Frame.Width - 10, sTemp.Height);
						lblInfo.TextAlignment = UITextAlignment.Left;
						lblInfo.TextColor = UIColor.Black;
						CurrentUser.StoreId(cr.customer.CustomerID.ToString());
						try
						{
							BtnTest1.Hidden = true;
							BtnTest2.Hidden = true;
							btnLogin.Hidden = false;
							btnResend.Hidden = false;
						}
						catch (Exception exe)
						{
							//Console.WriteLine(exe.Message);
						}

						start = 0;
						start = y + lblInfo.Frame.Height + 10;
						btnLogin.Frame = new CGRect(180, start, 120, 30);
						btnResend.Frame = new CGRect(30, start, 120, 30);

						btnResend.TouchUpInside += async (send, eve) =>
						{
							BTProgressHUD.Show("Sending verification email to " + cr.customer.Email);
							if (CardNumber != null)
							{
								await svc.ResendEMail(CardNumber);
							}
							else
							{
								await svc.ResendEMail(CurrentUser.GetCardNumber());
							}
							BTProgressHUD.ShowSuccessWithStatus("Sent");
						};
						btnLogin.TouchUpInside += (sen, ev) =>
						{
							try
							{
								BTProgressHUD.Show("Checking email verification");
								EmailVerification(false);
							}
							catch (Exception ex)
							{
								//LoggingClass.LogError(ex.Message, screenid, ex.StackTrace.ToString());
							}

						};
						BTProgressHUD.Dismiss();
					}
					else
					{
						lblInfo.Text = cr.ErrorDescription;
						//lblInfo.TextAlignment = UITextAlignment.Center;
						lblInfo.TextColor = UIColor.Red;
						try
						{
							btnLogin.Hidden = true;
							btnResend.Hidden = true;
						}
						catch (Exception exe)
						{
							//LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
						}
						sTemp = lblInfo.SizeThatFits(sTemp);
						lblInfo.Frame = new CGRect(0, start, View.Frame.Width - 10, sTemp.Height);
						BTProgressHUD.Dismiss();
					}
				}
				else
				{

					lblInfo.Text = "Sorry. Your Card number is not matching our records.\n Please re-scan Or Try app as Guest Log In.";
					lblInfo.TextColor = UIColor.Red;
					lblInfo.TextAlignment = UITextAlignment.Center;
					sTemp = lblInfo.SizeThatFits(sTemp);
					lblInfo.Frame = new CGRect(0, start, View.Frame.Width - 10, sTemp.Height);
					try
					{
						if (btnLogin != null || btnResend != null)
						{
							btnLogin.SetTitleColor(UIColor.White, UIControlState.Normal);
							btnResend.SetTitleColor(UIColor.White, UIControlState.Normal);
							btnLogin.BackgroundColor = UIColor.White;
							btnResend.BackgroundColor = UIColor.White;
						}
					}
					catch (Exception ex)
					{
						//LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
					}
					BTProgressHUD.Dismiss();
				}
				BTProgressHUD.Dismiss();
			}
			catch (Exception exe)
			{
				lblInfo.Text = "Something went wrong.We're on it.";
				lblInfo.TextColor = UIColor.Red;
				sTemp = lblInfo.SizeThatFits(sTemp);
				lblInfo.Frame = new CGRect(0, start, View.Frame.Width - 10, sTemp.Height);
				LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
			}
			BTProgressHUD.Dismiss();
		}