public async void EmailVerification() { try { DeviceToken Dt = new DeviceToken(); if (CurrentUser.GetId() != null) { Dt = await svc.VerifyMail(CurrentUser.GetId()); } if (Dt.VerificationStatus == 1) { CurrentUser.Store(cr.customer.CustomerID.ToString(), cr.customer.FirstName + cr.customer.LastName); CurrentUser.PutStore(cr.customer.PreferredStore); if (RootTabs == null || _window == null) { RootTabs = CurrentUser.RootTabs; _window = CurrentUser.window; nav = new UINavigationController(RootTabs); AddNavigationButtons(nav); _window.RootViewController = nav; LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid); } else { nav = new UINavigationController(RootTabs); AddNavigationButtons(nav); _window.RootViewController = nav; LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid); } BTProgressHUD.Dismiss(); } else { try { BTProgressHUD.ShowErrorWithStatus("Your email is not verified plesase check email and verify.", 5000); View.AddSubview(btnResend); } catch (Exception ex) { LoggingClass.LogError(ex.Message, screenid, ex.StackTrace); } } } catch (Exception Exe) { LoggingClass.LogError(Exe.Message, screenid, Exe.StackTrace); } }
public async void EmailVerification(Boolean start) { try { DeviceToken Dt = new DeviceToken(); if (CurrentUser.GetId() != null) { Dt = await svc.VerifyMail(CurrentUser.GetId()); try { if (cr.customer == null) { cr = await svc.GetCustomerDetails(Convert.ToInt32(CurrentUser.GetId())); } } catch (Exception exe) { //LoggingClass.LogError(exe.Message, screenid, exe.StackTrace); } } if (Dt.VerificationStatus == 1) { CurrentUser.Store(cr.customer.CustomerID.ToString(), cr.customer.FirstName + cr.customer.LastName); CurrentUser.PutStore(cr.customer.PreferredStore); if (RootTabs == null || _window == null) { RootTabs = CurrentUser.RootTabs; _window = CurrentUser.window; nav = new UINavigationController(RootTabs); AddNavigationButtons(nav); _window.RootViewController = nav; LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid); } else { nav = new UINavigationController(RootTabs); AddNavigationButtons(nav); _window.RootViewController = nav; LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid); } BTProgressHUD.Dismiss(); } else { if (start == false) { try { BTProgressHUD.ShowErrorWithStatus("Your email is not verified plesase check email and verify.", 5000); View.AddSubview(btnResend); } catch (Exception ex) { //LoggingClass.LogError(ex.Message, screenid, ex.StackTrace); } } } } catch (Exception Exe) { //UIAlertView alert = new UIAlertView() //{ //Title = Exe.Message+"\n"+Exe.StackTrace, // //Message = "Coming Soon..." //}; //alert.AddButton("OK"); //alert.Show(); LoggingClass.LogError(Exe.Message, screenid, Exe.StackTrace); } }
public override void ViewDidLoad() { try { LoggingClass.loginview = true; nfloat starty = 70; nfloat width = UIScreen.MainScreen.Bounds.Width; width = width / 2 - 15; if (Reachability.IsHostReachable("https://www.apple.com") == false) { UIAlertView alert = new UIAlertView() { Title = "Sorry", Message = "Not connected to internet,Connect and re try it." }; alert.AddButton("OK"); alert.Show(); } if (CurrentUser.GetCardNumber() != null) { PreInfo(CurrentUser.GetCardNumber()); } CGSize sTemp = new CGSize(View.Frame.Width-10, 100); try { EmailVerification(true); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace); } CurrentUser.RootTabs = RootTabs; CurrentUser.window = _window; MobileBarcodeScanner scanner = new MobileBarcodeScanner(); nfloat h = 31.0f; nfloat w = View.Bounds.Width; nfloat imageheight = screenheight/5; nfloat imagewidth = UIScreen.MainScreen.Bounds.Width; var imgLogo = new UIImageView(); imgLogo.Frame = new CGRect(((imagewidth/2)-(imageheight/2)), starty, imageheight, imageheight); imgLogo.Image = UIImage.FromFile("Images/lg.png"); y = starty + imageheight; lblIns = new UILabel(); lblIns.Text = "Please scan your VIP card barcode by touching below card:"; lblIns.LineBreakMode = UILineBreakMode.WordWrap; lblIns.Lines = 0; sTemp = lblIns.SizeThatFits(sTemp); lblIns.Frame = new CGRect(0, y, View.Frame.Width-10, sTemp.Height); lblIns.TextAlignment = UITextAlignment.Center; lblIns.TextColor = UIColor.Black; //Console.WriteLine(y+"\n"+sTemp.Height); y = y+sTemp.Height; lblInfo = new UILabel(); lblInfo.Frame = new CGRect(20, y, View.Frame.Width-10, h); lblInfo.LineBreakMode = UILineBreakMode.WordWrap; lblInfo.Lines = 0; lblInfo.TextAlignment = UITextAlignment.Center; lblInfo.TextColor = UIColor.Black; lblContactus = new UILabel(); lblContactus.TextColor = UIColor.Red; lblContactus.TextAlignment = UITextAlignment.Center; lblContactus.Hidden = true; nfloat hei = 180 + lblIns.Frame.Height + 10; btnCardScanner= new UIButton(); if (screenheight <= 568) { btnCardScanner.Frame = new CGRect((View.Frame.Width / 2) - 100, y, 200, 122); } else { btnCardScanner.Frame = new CGRect((View.Frame.Width / 2) - 100, y, 200, 152); } btnCardScanner.SetBackgroundImage(new UIImage("card-icon.png"), UIControlState.Normal); //height setting for button start = hei + btnCardScanner.Frame.Height + 10; //Console.WriteLine(hei); //Console.WriteLine(btnCardScanner.Frame.Height); //Console.WriteLine(start); //Console.WriteLine(View.Frame.Height); //568 //Scanning Button Click event btnCardScanner.TouchUpInside += async (sender, e) => { try { scanner.UseCustomOverlay = false; var result = await scanner.Scan(); if (result != null) { LoggingClass.LogInfo("User tried to login with" + result.Text, screenid); PreInfo(result.Text); //EmailVerification(); } } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace); } }; y = y + 200; //nfloat strtguest = strtbtn + btnLogin.Frame.Height + 10; UILabel lblGuest = new UILabel(); lblGuest.Frame = new CGRect(20, View.Frame.Height - 50, View.Frame.Width, h); lblGuest.Text = "Not a VIP Member?"; lblGuest.TextAlignment = UITextAlignment.Left; lblGuest.Font = UIFont.ItalicSystemFontOfSize(17); lblGuest.TextColor = UIColor.Black; btnGuestLogin = new UIButton(new CGRect(180, View.Frame.Height - 50, 120, 30)); btnGuestLogin.SetTitle("Guest Log In", UIControlState.Normal); btnGuestLogin.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; btnGuestLogin.SetTitleColor(UIColor.White, UIControlState.Normal); btnGuestLogin.BackgroundColor = UIColor.Purple; //btnGuestLogin.SetImage(UIImage.FromFile ("Images/gl.png"), UIControlState.Normal); btnLogin = new UIButton(new CGRect(180, strtbtn, 120, 30)); btnLogin.SetTitle("Log In", UIControlState.Normal); btnLogin.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; btnLogin.SetTitleColor(UIColor.White, UIControlState.Normal); btnLogin.BackgroundColor = UIColor.Purple; btnResend = new UIButton(new CGRect(30, strtbtn, 120, 30)); btnResend.SetTitle("Resend Email", UIControlState.Normal); btnResend.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; btnResend.SetTitleColor(UIColor.White, UIControlState.Normal); btnResend.BackgroundColor = UIColor.Purple; BtnTest1 = new UIButton(new CGRect(200, strtbtn, 100, 30)); BtnTest1.SetTitle("Continue", UIControlState.Normal); BtnTest1.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; BtnTest1.SetTitleColor(UIColor.White, UIControlState.Normal); BtnTest1.BackgroundColor = UIColor.Purple; BtnTest2 = new UIButton(new CGRect(30, strtbtn, 140, 30)); BtnTest2.SetTitle("Update E-Mail Id", UIControlState.Normal); BtnTest2.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; BtnTest2.SetTitleColor(UIColor.White, UIControlState.Normal); BtnTest2.BackgroundColor = UIColor.Purple; btnVerify = new UIButton(new CGRect(24, imageheight + 270, 240, 20)); btnVerify.SetTitle("Verify", UIControlState.Normal); btnVerify.HorizontalAlignment = UIControlContentHorizontalAlignment.Right; btnVerify.SetTitleColor(UIColor.Purple, UIControlState.Normal); btnGuestLogin.TouchDown += async (sender, e) => { CurrentUser.Store("0", "Guest"); if (RootTabs == null || _window == null) { _window = CurrentUser.window; RootTabs = CurrentUser.RootTabs; nav = new UINavigationController(RootTabs); //AddNavigationButtons(nav); _window.RootViewController = nav; //nav.DismissViewController(true); } nav = new UINavigationController(RootTabs); AddNavigationButtons(nav); CurrentUser.RootTabs = RootTabs; _window.RootViewController = nav; CurrentUser.window = _window; await svc.InsertUpdateGuest("Didn't get the token"); //this.NavigationController.PopToRootViewController (true); }; View.AddSubview(BtnTest1); View.AddSubview(BtnTest2); View.AddSubview(btnResend); View.AddSubview(btnLogin); View.AddSubview(imgLogo); View.AddSubview(btnGuestLogin); View.AddSubview(lblIns); View.AddSubview(btnCardScanner); View.AddSubview(lblInfo); View.AddSubview(lblGuest); View.AddSubview(lblContactus); View.BackgroundColor = UIColor.White; } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace); } }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { try { //downloading all wine images BlobWrapper.DownloadAllImages(); // Override point for customization after application launch. // If not required for your application you can safely delete this method UITabBarController RootTab = (UITabBarController)Window.RootViewController; //CurrentUser.Clear(); CurrentUser.Store("48732", "user Simulator"); //for direct log in //CurrentUser.PutCa rdNumber("7207589007"); //Console.WriteLine(DateTime.Now + " App opened"); UIImage profile = UIImage.FromFile("profile.png"); profile = ResizeImage(profile, 25, 25); _window = Window; UIImage info = UIImage.FromFile("Info.png"); info = ResizeImage(info, 25, 25); //Checking the user already logged in or not if (CurrentUser.RetreiveUserId() != 0) { ManageTabBar(RootTab); LoggingClass.LogInfo("App opened " + CurrentUser.RetreiveUserId(), screen); nav = new UINavigationController(RootTab); //Window.RootViewController = RootTab; AddNavigationButtons(nav); UIBarButtonItem.Appearance.TintColor = UIColor.FromRGB(128, 0, 128); Window.RootViewController = nav; } //Checking Guest logged in or not else if (CurrentUser.GetGuestId() != "0" && CurrentUser.GetGuestId() != null) { CurrentUser.Store("0", "Guest"); ManageTabBar(RootTab); //Console.WriteLine(DateTime.Now + " App opened"); nav = new UINavigationController(RootTab); //Window.RootViewController = RootTab; AddNavigationButtons(nav); UIBarButtonItem.Appearance.TintColor = UIColor.FromRGB(128, 0, 128); Window.RootViewController = nav; } else { ManageTabBar(RootTab); var login = new LoginViewController(); login.RootTabs = Window.RootViewController; login._window = Window; nav = new UINavigationController(login); //nav.NavigationBar.BackgroundColor = UIColor.FromRGB(97, 100, 142); UIBarButtonItem.Appearance.TintColor = UIColor.FromRGB(128, 0, 128); Window.RootViewController = nav; } } catch (Exception exe) { LoggingClass.LogError(exe.Message, screen, exe.StackTrace); } //Notification Settings if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var pushSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet()); UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings); UIApplication.SharedApplication.RegisterForRemoteNotifications(); } else { UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound; UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } return(true); }