public void OtpVerification(string sentOtp, string receivedOtp, string username)
 {
     //starting of otp verification code
     if (sentOtp == receivedOtp)
     {
         AlertDialog.Builder alert = new AlertDialog.Builder(this);
         alert.SetTitle("Successfully your logged in");
         alert.SetMessage("Thank You");
         alert.SetNegativeButton("Ok", delegate { });
         Dialog dialog = alert.Create();
         dialog.Show();
         CustomerResponse authen = new CustomerResponse();
         ServiceWrapper   svc    = new ServiceWrapper();
         try
         {
             /// authen = svc.AuthencateUser(username).Result;
             if (authen.customer != null && authen.customer.CustomerID != 0)
             {
                 CurrentUser.SaveUserName(username, authen.customer.CustomerID.ToString());
                 Intent intent = new Intent(this, typeof(TabActivity));
                 StartActivity(intent);
             }
             else
             {
                 AlertDialog.Builder aler = new AlertDialog.Builder(this);
                 aler.SetTitle("Sorry");
                 aler.SetMessage("You entered wrong ");
                 aler.SetNegativeButton("Ok", delegate { });
                 Dialog dialog1 = aler.Create();
                 dialog1.Show();
             };
         }
         catch (Exception exception)
         {
             if (exception.Message.ToString() == "One or more errors occurred.")
             {
                 AlertDialog.Builder aler = new AlertDialog.Builder(this);
                 aler.SetTitle("Sorry");
                 aler.SetMessage("Please check your internet connection");
                 aler.SetNegativeButton("Ok", delegate { });
                 Dialog dialog2 = aler.Create();
                 dialog2.Show();
             }
             else
             {
                 AlertDialog.Builder aler = new AlertDialog.Builder(this);
                 aler.SetTitle("Sorry");
                 aler.SetMessage("We're under maintanence");
                 aler.SetNegativeButton("Ok", delegate { });
                 Dialog dialog3 = aler.Create();
                 dialog3.Show();
             }
         }
     }
     else
     {
         AlertDialog.Builder aler = new AlertDialog.Builder(this);
         aler.SetTitle("Incorrect Otp");
         aler.SetMessage("Please Check Again");
         aler.SetNegativeButton("Ok", delegate { });
         Dialog dialog = aler.Create();
         dialog.Show();
     }
     //Ending of otp verification code
 }
        public async void Preinfo(string CardNumber)
        {
            AndHUD.Shared.Show(this, "Please Wait...", Convert.ToInt32(MaskType.Clear));
            try
            {
                BtnLogin.Visibility  = ViewStates.Gone;
                BtnResend.Visibility = ViewStates.Gone;
                try
                {
                    //CurrentUser.
                    EmailVerification(false);
                }
                catch (Exception ex)
                {
                    LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
                }
                AuthServ = await svc.AuthencateUser("test", CardNumber, CurrentUser.GetDeviceID());

                CurrentUser.SaveInternalCustometID(AuthServ.customer.CustomerID.ToString());
                LoggingClass.LogInfo("User Tried to login with " + CardNumber, screenid);
                if (CardNumber != null)
                {
                    CurrentUser.SaveCardNumber(CardNumber);
                }
                if (AuthServ != null)
                {
                    CurrentUser.SaveUserName(AuthServ.customer.FirstName + AuthServ.customer.LastName, AuthServ.customer.CustomerID.ToString());
                    CurrentUser.SavePrefered(AuthServ.customer.PreferredStore);
                    if (AuthServ.customer.Email != "" && AuthServ.customer.Email != null)
                    {
                        SendRegistrationToAppServer(CurrentUser.getDeviceToken());
                        if (AuthServ.ErrorDescription != null || AuthServ.ErrorDescription == "")
                        {
                            TxtScanresult.Text = AuthServ.ErrorDescription;
                        }
                        else
                        {
                            TxtScanresult.Text = " Hi " + AuthServ.customer.FirstName + AuthServ.customer.LastName + ",\nWe are sending a verification email to " + AuthServ.customer.Email + "..To proceed press continue. To change your emailAddress click on Update.";
                        }
                        TxtScanresult.SetTextColor(Android.Graphics.Color.Black);
                        BtnContinue.Visibility    = ViewStates.Visible;
                        BtnUpdateEmail.Visibility = ViewStates.Invisible;
                        update.Visibility         = ViewStates.Visible;
                        BtnContinue.Click        += async delegate
                        {
                            {
                                AndHUD.Shared.Show(this, " Please Wait...", Convert.ToInt32(MaskType.Clear));
                                AuthServ = await svc.ContinueService(AuthServ);

                                ShowInfo(AuthServ);
                                AndHUD.Shared.Dismiss();
                            }
                        };
                        update.Click += delegate
                        {
                            TxtScanresult.Text        = "";
                            BtnContinue.Visibility    = ViewStates.Gone;
                            update.Visibility         = ViewStates.Gone;
                            txtmail.Visibility        = ViewStates.Visible;
                            Txtem.Visibility          = ViewStates.Visible;
                            BtnUpdateEmail.Visibility = ViewStates.Visible;
                        };
                        BtnUpdateEmail.Click += delegate
                        {
                            {
                                BtnUpdateEmail_Click("please enter your new e-mail id.");
                            }
                        };
                    }
                    else
                    {
                        if (AuthServ.ErrorDescription != null || AuthServ.ErrorDescription == "")
                        {
                            TxtScanresult.Text = AuthServ.ErrorDescription;
                        }
                        else
                        {
                            TxtScanresult.Text = "Hi " + AuthServ.customer.FirstName + AuthServ.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.";
                        }
                        TxtScanresult.SetTextColor(Android.Graphics.Color.Red);
                        BtnContinue.Visibility    = ViewStates.Gone;
                        BtnUpdateEmail.Visibility = ViewStates.Visible;
                        txtmail.Visibility        = ViewStates.Visible;
                        Txtem.Visibility          = ViewStates.Visible;
                        BtnUpdateEmail.Click     += delegate
                        {
                            BtnUpdateEmail_Click("please enter your new e-mail id.");
                        };
                    }
                }
                else
                {
                    TxtScanresult.Text   = "Sorry. Your Card number is not matching our records.\n Please re-scan Or Try app as Guest Log In.";
                    BtnResend.Visibility = ViewStates.Invisible;
                    BtnLogin.Visibility  = ViewStates.Invisible;
                    TxtScanresult.SetTextColor(Android.Graphics.Color.Red);
                    AndHUD.Shared.Dismiss();
                }
                AndHUD.Shared.Dismiss();
            }
            catch (Exception exe)
            {
            }
        }
Beispiel #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.OtpReceiverLayout);
            string   Sentotp         = Intent.GetStringExtra("otp");
            string   username        = Intent.GetStringExtra("username");
            EditText receivedOtp     = FindViewById <EditText>(Resource.Id.txtOtp);
            Button   btnVerification = FindViewById <Button>(Resource.Id.btnVerify);

            btnVerification.Click += delegate
            {
                if (Sentotp == receivedOtp.Text)
                {
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);
                    alert.SetTitle("Successfully your logged in");
                    alert.SetMessage("Thank You");
                    alert.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = alert.Create();
                    dialog.Show();
                    CustomerResponse authen = new CustomerResponse();
                    ServiceWrapper   svc    = new ServiceWrapper();
                    try
                    {
                        authen = svc.AuthencateUser(username).Result;
                        if (authen.customer != null && authen.customer.CustomerID != 0)
                        {
                            CurrentUser.SaveUserName(username, authen.customer.CustomerID.ToString());
                            Intent intent = new Intent(this, typeof(TabActivity));
                            StartActivity(intent);
                        }
                        else
                        {
                            AlertDialog.Builder aler = new AlertDialog.Builder(this);
                            aler.SetTitle("Sorry");
                            aler.SetMessage("You entered wrong ");
                            aler.SetNegativeButton("Ok", delegate { });
                            Dialog dialog1 = aler.Create();
                            dialog1.Show();
                        };
                    }
                    catch (Exception exception)
                    {
                        if (exception.Message.ToString() == "One or more errors occurred.")
                        {
                            AlertDialog.Builder aler = new AlertDialog.Builder(this);
                            aler.SetTitle("Sorry");
                            aler.SetMessage("Please check your internet connection");
                            aler.SetNegativeButton("Ok", delegate { });
                            Dialog dialog2 = aler.Create();
                            dialog2.Show();
                        }
                        else
                        {
                            AlertDialog.Builder aler = new AlertDialog.Builder(this);
                            aler.SetTitle("Sorry");
                            aler.SetMessage("We're under maintanence");
                            aler.SetNegativeButton("Ok", delegate { });
                            Dialog dialog3 = aler.Create();
                            dialog3.Show();
                        }
                    }
                }
                else
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this);
                    aler.SetTitle("Incorrect Otp");
                    aler.SetMessage("Please Check Again");
                    aler.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = aler.Create();
                    dialog.Show();
                }
            };
        }
Beispiel #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Dummy);

            Button             btnGallery = FindViewById <Button>(Resource.Id.btnTest);
            ServiceWrapper     svc = new ServiceWrapper();
            ItemReviewResponse md, md1 = new ItemReviewResponse();

            CurrentUser.SaveUserName("lok", "3");
            List <Review> Arr;

            md  = svc.GetItemReviewUID(Convert.ToInt32(CurrentUser.getUserId())).Result;
            Arr = md.Reviews.ToList();
            int oldcont = Arr.Count;

            md1 = svc.GetItemReviewUID(Convert.ToInt32(CurrentUser.getUserId())).Result;
            //CurrentUser.putCount(oldcont);
            Arr = md1.Reviews.ToList();
            int newcoun = Arr.Count;

            if (oldcont != newcoun)
            {
                Notification.Builder builder = new Notification.Builder(this)
                                               .SetContentTitle("You've reviewed new wine")
                                               .SetContentText("https://developer.xamarin.com/guides/android/application_fundamentals/notifications/remote-notifications-with-gcm/")
                                               .SetSmallIcon(Resource.Drawable.user1);
                Notification        notification        = builder.Build();
                NotificationManager notificationManager =
                    GetSystemService(Context.NotificationService) as NotificationManager;
                const int notificationId = 0;
                notificationManager.Notify(notificationId, notification);
            }

            //btnGallery.Click += delegate
            //{
            //    Notification.Builder builder = new Notification.Builder(this)
            //    .SetContentTitle("hi Notification")
            //    .SetContentText("https://developer.xamarin.com/guides/android/application_fundamentals/notifications/remote-notifications-with-gcm/")
            //    .SetSmallIcon(Resource.Drawable.user1);
            //    Notification notification = builder.Build();
            //    NotificationManager notificationManager =
            //    GetSystemService(Context.NotificationService) as NotificationManager;
            //    const int notificationId = 0;
            //    notificationManager.Notify(notificationId, notification);
            //    //Intent intent = new Intent(this, typeof(ProfilePictureGallery));
            //StartActivity(intent);
            //};



            ////AsyncDownload asn = new AsyncDownload();
            //ImageView imageView = FindViewById<ImageView>(Resource.Id.imageView1);
            //LinearLayout progressLayout = FindViewById<LinearLayout>(Resource.Id.progressLayout);
            //progressLayout.Visibility = ViewStates.Gone;
            //Button downloadButton = FindViewById<Button>(Resource.Id.downloadButton);
            //downloadButton.Click += downloadAsync;

            //async void downloadAsync(object sender, System.EventArgs ea)
            //{
            //    webClient = new WebClient();
            //    var url = new Uri("https://icsintegration.blob.core.windows.net/bottleimagesdetails/198.jpg");
            //    byte[] imageBytes = null;
            //    progressLayout.Visibility = ViewStates.Visible;
            //    try
            //    {
            //        imageBytes = await webClient.DownloadDataTaskAsync(url);
            //    }
            //    catch (TaskCanceledException)
            //    {
            //        this.progressLayout.Visibility = ViewStates.Gone;
            //        return;
            //    }
            //    catch (Exception exe)
            //    {
            //        progressLayout.Visibility = ViewStates.Gone;
            //        downloadButton.Click += downloadAsync;
            //        downloadButton.Text = "Download Image";
            //        return;
            //    }

            //    try
            //    {
            //        string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            //        string localFilename = "Wine.png";
            //        string localPath = System.IO.Path.Combine(documentsPath, localFilename);

            //        FileStream fs = new FileStream(localPath, FileMode.OpenOrCreate);
            //        await fs.WriteAsync(imageBytes, 0, imageBytes.Length);
            //        Console.WriteLine("Saving image in local path: " + localPath);
            //        fs.Close();

            //        BitmapFactory.Options options = new BitmapFactory.Options();
            //        options.InJustDecodeBounds = true;
            //        await BitmapFactory.DecodeFileAsync(localPath, options);


            //    //options.InSampleSize = options.OutWidth > options.OutHeight ? options.OutHeight / imageView.Height : options.OutWidth / imageView.Width;
            //    //options.InJustDecodeBounds = false;

            //    Bitmap bitmap = await BitmapFactory.DecodeFileAsync(localPath);
            //    imageView.SetImageBitmap(bitmap);
            //    }
            //    catch (Exception e)
            //    {


            //    }

            //    progressLayout.Visibility = ViewStates.Gone;
            //    downloadButton.Click += downloadAsync;
            //    downloadButton.Text = "Download Image";
            //}

            //    public static async Task<bool> SaveCache(Stream data, string id)
            //{
            //    try
            //    {
            //        //cache folder in local storage
            //        IFolder rootFolder = FileSystem.Current.LocalStorage;
            //        var folder = await rootFolder.CreateFolderAsync("Cache",
            //            CreationCollisionOption.OpenIfExists);
            //        //save cached data
            //        IFile file = await folder.CreateFileAsync(id, CreationCollisionOption.ReplaceExisting);
            //        byte[] buffer = new byte[data.Length];
            //        data.Read(buffer, 0, buffer.Length);
            //        using (Stream stream = await file.OpenAsync(FileAccess.ReadAndWrite))
            //        {
            //            stream.Write(buffer, 0, buffer.Length);
            //        }
            //        return true;
            //    }
            //    catch
            //    {
            //        //some logging
            //        return false;
            //    }
            //}

            //public static async Task<Stream> LoadCache(string id)
            //{
            //    //cache folder in local storage
            //    IFolder rootFolder = FileSystem.Current.LocalStorage;
            //    var folder = await rootFolder.CreateFolderAsync("Cache",
            //        CreationCollisionOption.OpenIfExists);

            //    var isExists = await folder.CheckExistsAsync(id);

            //    if (isExists == ExistenceCheckResult.FileExists)
            //    {
            //        //file exists - load it from cache
            //        IFile file = await folder.GetFileAsync(id);
            //        return await file.OpenAsync(FileAccess.Read);
            //    }
            //}
            //    return null;
            //}
        }
Beispiel #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.login);
            MobileCenter.Start("{Analytics,Crashes,Distribute}", typeof(Analytics), typeof(Crashes), typeof(Distribute));

            Button login = FindViewById <Button>(Resource.Id.btnLoginLL);

            EditText username      = FindViewById <EditText>(Resource.Id.txtUsername);
            EditText txtUserNumber = FindViewById <EditText>(Resource.Id.MobileNumber);

            ServiceWrapper svc = new ServiceWrapper();
            //new Thread(new ThreadStart(delegate
            //{
            //    RunOnUiThread(() => bvb.DownloadImages(Convert.ToInt32(CurrentUser.getUserId())));
            //})).Start();

            //bvb.DownloadImages(Convert.ToInt32(CurrentUser.getUserId()));
            var TaskA = new Task(() => {
                BlobWrapper.DownloadImages(Convert.ToInt32(CurrentUser.getUserId()));
            });

            TaskA.Start();


            if (CurrentUser.getUserName() == null ||
                CurrentUser.getUserName() == "")
            {
                // Do nothing
            }
            else
            {
                Intent intent = new Intent(this, typeof(TabActivity));
                StartActivity(intent);
            }



            login.Click += delegate
            {
                //1. Call Auth service and check for this user, it returns one.
                //2. If it returns 1 save Username and go to Tab Activity.
                //3. Else Show message, incorrect username.
                //
                if (username.Text == "") //|| txtUserNumber.Text == "")
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this);
                    aler.SetTitle("Sorry");
                    aler.SetMessage("Enter proper details");
                    aler.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = aler.Create();
                    dialog.Show();
                    return;
                }
                else
                {
                    CustomerResponse authen = new CustomerResponse();
                    try
                    {
                        authen = svc.AuthencateUser(username.Text).Result;
                        if (authen.customer != null && authen.customer.CustomerID != 0)
                        {
                            CurrentUser.SaveUserName(username.Text, authen.customer.CustomerID.ToString());
                            Intent intent = new Intent(this, typeof(TabActivity));
                            StartActivity(intent);
                        }
                        else
                        {
                            AlertDialog.Builder aler = new AlertDialog.Builder(this);
                            aler.SetTitle("Sorry");
                            aler.SetMessage("You entered wrong ");
                            aler.SetNegativeButton("Ok", delegate { });
                            Dialog dialog1 = aler.Create();
                            dialog1.Show();
                        };
                    }
                    catch (Exception exception)
                    {
                        if (exception.Message.ToString() == "One or more errors occurred.")
                        {
                            AlertDialog.Builder aler = new AlertDialog.Builder(this);
                            aler.SetTitle("Sorry");
                            aler.SetMessage("Please check your internet connection");
                            aler.SetNegativeButton("Ok", delegate { });
                            Dialog dialog2 = aler.Create();
                            dialog2.Show();
                        }
                        else
                        {
                            AlertDialog.Builder aler = new AlertDialog.Builder(this);
                            aler.SetTitle("Sorry");
                            aler.SetMessage("We're under maintanence");
                            aler.SetNegativeButton("Ok", delegate { });
                            Dialog dialog3 = aler.Create();
                            dialog3.Show();
                        }
                    }
                    MobileCenter.Start("4403e7d2-95d8-414e-9390-6c1dbd241c21",
                                       typeof(Analytics), typeof(Crashes));

                    //SendSmsgs(txtUserNumber.Text);
                    //var intent = new Intent(this, typeof(VerificationActivity));
                    ////var intent = new Intent(this, typeof(TabActivity));
                    //intent.PutExtra("otp", otp);
                    //intent.PutExtra("username", username.Text);
                    //StartActivity(intent);
                }
                //CustomerResponse authen = new CustomerResponse();
                //try
                //{
                //    authen = svc.AuthencateUser(username.Text).Result;
                //    if (authen.customer != null && authen.customer.CustomerID != 0)
                //    {
                //        CurrentUser.SaveUserName(username.Text, authen.customer.CustomerID.ToString());
                //        Intent intent = new Intent(this, typeof(TabActivity));
                //        StartActivity(intent);

                //    }
                //    else
                //    {
                //        AlertDialog.Builder aler = new AlertDialog.Builder(this);
                //        aler.SetTitle("Sorry");
                //        aler.SetMessage("Incorrect Details");
                //        aler.SetNegativeButton("Ok", delegate { });
                //        Dialog dialog = aler.Create();
                //        dialog.Show();
                //    };
                //}
                //catch(Exception exception)
                //{
                //    if (exception.Message.ToString() == "One or more errors occurred.")
                //    {
                //        AlertDialog.Builder aler = new AlertDialog.Builder(this);
                //        aler.SetTitle("Sorry");
                //        aler.SetMessage("Please check your internet connection");
                //        aler.SetNegativeButton("Ok", delegate { });
                //        Dialog dialog = aler.Create();
                //        dialog.Show();
                //    }
                //    else {
                //        AlertDialog.Builder aler = new AlertDialog.Builder(this);
                //        aler.SetTitle("Sorry");
                //        aler.SetMessage("We're under maintanence");
                //        aler.SetNegativeButton("Ok", delegate { });
                //        Dialog dialog = aler.Create();
                //        dialog.Show();

                //    }

                //}
            };
        }
Beispiel #6
0
        public async void EmailVerification()
        {
            int count = 0;

            if (count == 0)
            {
                AndHUD.Shared.Show(this, "Checking Email Verification", Convert.ToInt32(MaskType.Clear));
                AuthServ = await svc.AuthencateUser("test", CurrentUser.GetCardNumber(), CurrentUser.GetDeviceID());

                DeviceToken DO = new DeviceToken();
                try
                {
                    DO = await svc.CheckMail(AuthServ.customer.CustomerID.ToString());

                    if (DO.VerificationStatus == 1)
                    {
                        if (AuthServ.customer != null && AuthServ.customer.CustomerID != 0)
                        {
                            LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.getUserId(), screenid);
                            CurrentUser.SaveUserName(AuthServ.customer.FirstName + AuthServ.customer.LastName, AuthServ.customer.CustomerID.ToString());
                            SendRegistrationToAppServer(CurrentUser.getDeviceToken());
                            CurrentUser.SavePrefered(AuthServ.customer.PreferredStore);
                            int storename = AuthServ.customer.PreferredStore;
                            if (storename == 1)
                            {
                                Intent intent = new Intent(this, typeof(GridViewActivity));
                                intent.PutExtra("MyData", "Wall Store");
                                ProgressIndicator.Show(this);

                                StartActivity(intent);
                            }
                            else if (storename == 2)
                            {
                                Intent intent = new Intent(this, typeof(GridViewActivity));
                                intent.PutExtra("MyData", "Point Pleasant Store");

                                ProgressIndicator.Show(this);
                                StartActivity(intent);
                            }
                            else
                            {
                                Intent intent = new Intent(this, typeof(TabActivity));
                                ProgressIndicator.Show(this);
                                StartActivity(intent);
                            }
                            LoggingClass.LogInfoEx("User verified and Logging" + "---->" + CurrentUser.GetCardNumber(), screenid);
                            AndHUD.Shared.Dismiss();
                            AndHUD.Shared.ShowSuccess(Parent, "Success!", MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                        else
                        {
                            int count12 = 0;
                            if (count12 == 0)
                            {
                                AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                                aler.SetTitle("Sorry");
                                aler.SetMessage("You entered wrong details or authentication failed");
                                aler.SetNegativeButton("Ok", delegate { });
                                Dialog dialog1 = aler.Create();
                                dialog1.Show();
                                //   AndHUD.Shared.ShowErrorWithStatus(this, "You entered wrong details or authentication failed", MaskType.Clear, TimeSpan.FromSeconds(2));
                            }
                            count12 = 1;
                        };
                    }
                    else
                    {
                        AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                        //aler.SetTitle("Sorry");
                        aler.SetMessage("Your email is not verified. please check email and verify.");
                        aler.SetNegativeButton("Ok", delegate { });
                        Dialog dialog = aler.Create();
                        dialog.Show();
                        //  AndHUD.Shared.ShowErrorWithStatus(this, "Your email is not verified plesase check email and verify.", MaskType.Clear, TimeSpan.FromSeconds(2));
                    }
                    //ProgressIndicator.Hide();
                    AndHUD.Shared.Dismiss();
                }

                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                }
                AndHUD.Shared.Dismiss();
            }
            count = 1;
        }
Beispiel #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            CheckInternetConnection();
            Stopwatch st = new Stopwatch();

            st.Start();
            //for direct login
            //CurrentUser.SaveUserName("Mohana Android","48732");
            //Preinfo("8902519310330");
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.login);
            var TaskA = new System.Threading.Tasks.Task(() =>
            {
                BlobWrapper.DownloadImages(Convert.ToInt32(CurrentUser.getUserId()));
            });

            TaskA.Start();
            ImageButton BtnScanner    = FindViewById <ImageButton>(Resource.Id.btnScanner);
            Button      BtnGuestLogin = FindViewById <Button>(Resource.Id.btnGuestLogin);

            LoggingClass.LogInfo("Opened the app", screenid);

            BtnScanner.Click += async delegate
            {
                try
                {
                    MobileBarcodeScanner.Initialize(Application);
                    var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                    scanner.UseCustomOverlay = false;
                    var result = await scanner.Scan();//"8902519310330";//await scanner.Scan();

                    if (result.Text != null)
                    {
                        LoggingClass.LogInfo("User Tried to login with " + result, screenid);
                        Preinfo(result.Text);
                        CurrentUser.SaveCardNumber(result.Text);
                    }
                }
                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                }
                BtnScanner.Click -= null;
            };

            BtnGuestLogin.Click += async delegate
            {
                //await svc.InsertUpdateGuest(CurrentUser.getAuthToken());
                CurrentUser.SaveUserName("Guest", "0");


                Intent intent = new Intent(this, typeof(TabActivity));
                ProgressIndicator.Show(this);
                LoggingClass.LogInfo("User Tried to login with Guest Login ", screenid);
                StartActivity(intent);
                await svc.InsertUpdateGuest("Didn't get the token");
            };
            TxtScanresult             = FindViewById <TextView>(Resource.Id.txtScanresult);
            BtnLogin                  = FindViewById <Button>(Resource.Id.btnLogin);
            BtnResend                 = FindViewById <Button>(Resource.Id.btnResend);
            BtnContinue               = FindViewById <Button>(Resource.Id.btnContinue);
            BtnUpdateEmail            = FindViewById <Button>(Resource.Id.btnUpdateEmail);
            BtnResend.Visibility      = ViewStates.Invisible;
            BtnLogin.Visibility       = ViewStates.Invisible;
            BtnContinue.Visibility    = ViewStates.Invisible;
            BtnUpdateEmail.Visibility = ViewStates.Invisible;
            if (IsPlayServicesAvailable())
            {
                var TaskB = new System.Threading.Tasks.Task(() =>
                {
                    var intent = new Intent(this, typeof(RegistrationIntentService));
                    StartService(intent);
                });
                TaskB.Start();
            }
            if (CurrentUser.getUserName() == null ||
                CurrentUser.getUserName() == "")
            {
                SendRegistrationToAppServer(CurrentUser.getDeviceToken());
                if (CurrentUser.GetCardNumber() != null)
                {
                    Preinfo(CurrentUser.GetCardNumber());
                }
            }
            else if (CurrentUser.GetGuestId() != null || CurrentUser.getUserId() == "0")
            {
                Intent intent = new Intent(this, typeof(TabActivity));
                ProgressIndicator.Show(this);
                LoggingClass.LogInfo("User Tried to login with Guest Login ", screenid);
                StartActivity(intent);
            }
            else
            {
                int storename = Convert.ToInt32(CurrentUser.GetPrefered());
                if (storename == 1)
                {
                    Intent intent = new Intent(this, typeof(GridViewActivity));
                    intent.PutExtra("MyData", "Wall Store");
                    ProgressIndicator.Show(this);
                    StartActivity(intent);
                }
                else if (storename == 2)
                {
                    Intent intent = new Intent(this, typeof(GridViewActivity));
                    intent.PutExtra("MyData", "Point Pleasant Store");
                    ProgressIndicator.Show(this);
                    StartActivity(intent);
                }
                else
                {
                    Intent intent = new Intent(this, typeof(TabActivity));
                    ProgressIndicator.Show(this);
                    StartActivity(intent);
                }
            }
            var telephonyDeviceID             = string.Empty;
            var telephonySIMSerialNumber      = string.Empty;
            TelephonyManager telephonyManager = (TelephonyManager)this.ApplicationContext.GetSystemService(Context.TelephonyService);

            if (telephonyManager != null)
            {
                if (!string.IsNullOrEmpty(telephonyManager.DeviceId))
                {
                    telephonyDeviceID = telephonyManager.DeviceId;
                }
                if (!string.IsNullOrEmpty(telephonyManager.SimSerialNumber))
                {
                    telephonySIMSerialNumber = telephonyManager.SimSerialNumber;
                }
            }
            var androidID  = Android.Provider.Settings.Secure.GetString(this.ApplicationContext.ContentResolver, Android.Provider.Settings.Secure.AndroidId);
            var deviceUuid = new UUID(androidID.GetHashCode(), ((long)telephonyDeviceID.GetHashCode() << 32) | telephonySIMSerialNumber.GetHashCode());
            var DeviceID   = deviceUuid.ToString();

            CurrentUser.SaveDeviceID(DeviceID);
        }