コード例 #1
0
		public async void PreInfo(string CardNumber)
		{
			CGSize sTemp = new CGSize(View.Frame.Width, 100);
			try
			{
				if (btnLogin != null && btnResend != null)
				{
					btnLogin.Hidden = true;
					btnResend.Hidden = true;
				}
				BTProgressHUD.Show(LoggingClass.txtpleasewait);
				try
				{
					EmailVerification(true);
				}
				catch (Exception exe)
				{
					//Console.WriteLine(exe.Message, exe.StackTrace);
				}
				cr = await svc.AuthencateUser("email", CardNumber, uid_device);
				if (CardNumber != null)
				{
					CurrentUser.PutCardNumber(CardNumber);
				}
				if (cr != null)
				{
					//Updating device token in different thread
					var TaskA = new System.Threading.Tasks.Task(() =>
					{
						updatetoken(cr);
					});
					TaskA.Start();
					//Storing customerid and updating the device tokens
					CurrentUser.StoreId(cr.customer.CustomerID.ToString());
					if (cr.customer.Email != null && cr.customer.Email != "")
					{
						if ((cr.ErrorDescription == null && cr.ErrorDescription == "") && cr.customer.CustomerID != 0)
						{
							//Console.WriteLine("Error Description is not there");
							lblInfo.Text = "Hi " + cr.customer.FirstName
								+ " " + cr.customer.LastName +
								", \nWe are sending a verification email to " +
								cr.customer.Email +
								" . To proceed press continue.\nTo change your emailAddress click on Update.";
						}
						else
						{
							lblInfo.Text = cr.ErrorDescription;
						}
						lblInfo.LineBreakMode = UILineBreakMode.WordWrap;
						lblInfo.TextAlignment = UITextAlignment.Justified;
						lblInfo.Lines = 0;
						sTemp = lblInfo.SizeThatFits(sTemp);
						if (screenheight <= 568)
						{
							y = y - 80;
							lblInfo.Frame = new CGRect(10, y, View.Frame.Width - 10, sTemp.Height);
						}
						else
						{
							lblInfo.Frame = new CGRect(10, y, View.Frame.Width - 10, sTemp.Height);
						}
						lblInfo.TextAlignment = UITextAlignment.Left;
						lblInfo.TextColor = UIColor.Black;
						lblInfo.Font = UIFont.FromName("HelveticaNeue", 15f);
						CurrentUser.StoreId(cr.customer.CustomerID.ToString());
						start = 0;
						start = y + lblInfo.Frame.Height + 10;
						//Console.WriteLine("Error " + cr.ErrorDescription);
						BtnTest1.Frame = new CGRect(180, start, 120, 30);
						BtnTest2.Frame = new CGRect(30, start, 140, 30);
						try
						{
							BtnTest1.Hidden = false;
							BtnTest2.Hidden = false;
						}
						catch (Exception ex)
						{
							//LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
						}
						BtnTest1.TouchUpInside += async delegate
						 {
							 BTProgressHUD.Show(LoggingClass.txtloading);
							 cr = await svc.ContinueService(cr);
							 ShowInfo(cr, false);
							 //btnCardScanner.Hidden = true;
						 };
						BtnTest2.TouchUpInside += delegate
						{
							BTProgressHUD.Show(LoggingClass.txtloading);
							UpdateEmail("Please enter your new E-mail Id");
							//btnCardScanner.Hidden = true;
						};
					}
					else
					{
						emailnotpresent = true;
						//Console.WriteLine("Error Discription before if " + cr.ErrorDescription);
						if ((cr.ErrorDescription == null && cr.ErrorDescription == "") || cr.customer.CustomerID != 0)
						{
							//Console.WriteLine("Error Discription in if " + cr.ErrorDescription);
							UpdateEmail("Hi " + cr.customer.FirstName + cr.customer.LastName +
										", \nIt seems we do not have your email address! Please update it so we can send you a verification link that will activate your account.");
						}
						else
						{
							UpdateEmail(cr.ErrorDescription);
						}
					}
					BTProgressHUD.Dismiss();

				}
				else
				{
					try
					{
						BtnTest2.Hidden = true;
						BtnTest1.Hidden = true;
						btnLogin.Hidden = true;
						btnResend.Hidden = true;
					}
					catch (Exception ex)
					{
						//Console.WriteLine(ex.Message);
					}
					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, y, View.Frame.Width - 10, sTemp.Height);
					BTProgressHUD.Dismiss();
				}
			}
			catch (Exception ex)
			{
				//Console.WriteLine(ex.Message);
			}
		}