public async void LoginByPin(string value)
        {
            WarningText    = "";
            WarningVisible = false;
            if (value == "Delete")
            {
                if (pin.Length > 0)
                {
                    pin = pin.Remove(pin.Length - 1);
                    int countPin = pin.Length;
                    HintColorChange(countPin);
                }
            }
            else
            {
                bool isExistvalue = Unities.CheckDigitaAndLength(value, 1);
                if (!isExistvalue)
                {
                    WarningText    = "ค่าที่ใส่ไม่ใช่ตัวเลข";
                    WarningVisible = true;
                    try
                    {
                        Vibration.Vibrate();
                        var duration = TimeSpan.FromSeconds(1);
                        Vibration.Vibrate(duration);
                    }
                    catch (FeatureNotSupportedException ex)
                    {
                    }
                    catch (Exception ex)
                    {
                    }
                }
                pin += value;
                int countPin = pin.Length;
                HintColorChange(countPin);
                if (countPin == 6)
                {
                    var loginPinData = await _pinService.LoginByPin(pin, email);

                    if (loginPinData != null && !loginPinData.IsError && loginPinData.Model != null)
                    {
                        if (loginPinData.Model.IsLogin)
                        {
                            try
                            {
                                await SecureStorage.SetAsync("CountLogin", "0");

                                var refreshToken = await SecureStorage.GetAsync("RefreshToken");;
                                var tokenData    = await _authService.GetTokenByRefreshToken(email, refreshToken);

                                if (tokenData != null || !tokenData.IsError)
                                {
                                    if (tokenData.Model == null || tokenData.Model.Token == null)
                                    {
                                        ErrorViewModel errorViewModel = new ErrorViewModel("กรุณาเข้าสู่ระบบอีกครั้ง", (int)EW_Enumerations.EW_ErrorTypeEnum.Error, ForceLogoutForErrorPopup);
                                        await PopupNavigation.Instance.PushAsync(new Error(errorViewModel));
                                    }
                                    else
                                    {
                                        await SecureStorage.SetAsync("Token", tokenData.Model.Token);

                                        App.Account = await SecureStorage.GetAsync("Account");

                                        App.Email = await SecureStorage.GetAsync("Email");

                                        App.FirstName = await SecureStorage.GetAsync("FirstName");

                                        App.LastName = await SecureStorage.GetAsync("LastName");

                                        string preBirthDate = await SecureStorage.GetAsync("BirthDate");

                                        try
                                        {
                                            App.BirthDate = DateTime.Parse(preBirthDate);
                                        }
                                        catch (Exception)
                                        {
                                        }
                                        App.MobileNumber = await SecureStorage.GetAsync("MobileNumber");

                                        int gender = 0;
                                        int.TryParse(await SecureStorage.GetAsync("Gender"), out gender);
                                        App.Gender = (EWalletV2.Api.ViewModels.EW_Enumerations.EW_GenderEnum)gender;
                                        Application.Current.MainPage = new NavigationPage(new UserTabbedPage());
                                    }
                                }
                                else
                                {
                                    pin      = "";
                                    countPin = pin.Length;
                                    HintColorChange(countPin);
                                    WarningText    = "ไม่สามารถเชื่อมต่อได้";
                                    WarningVisible = true;
                                    try
                                    {
                                        Vibration.Vibrate();
                                        var duration = TimeSpan.FromSeconds(1);
                                        Vibration.Vibrate(duration);
                                    }
                                    catch (FeatureNotSupportedException ex)
                                    {
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                ErrorViewModel errorViewModel = new ErrorViewModel("โทรศัพท์ของท่านไม่สามารถใช้งานแอพพลิเคชั่นนี้ได้", (int)EW_Enumerations.EW_ErrorTypeEnum.Warning, CloseApp);
                                await PopupNavigation.Instance.PushAsync(new Error(errorViewModel));
                            }
                        }
                        else
                        {
                            pin      = "";
                            countPin = pin.Length;
                            HintColorChange(countPin);
                            WarningText    = "รหัสผ่านไม่ถูกต้อง";
                            WarningVisible = true;
                            try
                            {
                                Vibration.Vibrate();
                                var duration = TimeSpan.FromSeconds(1);
                                Vibration.Vibrate(duration);
                            }
                            catch (FeatureNotSupportedException ex)
                            {
                            }
                            catch (Exception ex)
                            {
                            }
                            countLogin++;
                            await SecureStorage.SetAsync("CountLogin", countLogin.ToString());

                            if (countLogin >= 5)
                            {
                                ForceLogout();
                            }
                        }
                    }
                    else
                    {
                        pin      = "";
                        countPin = pin.Length;
                        HintColorChange(countPin);
                        WarningText    = "ไม่สามารถเชื่อมต่อได้";
                        WarningVisible = true;
                        try
                        {
                            Vibration.Vibrate();
                            var duration = TimeSpan.FromSeconds(1);
                            Vibration.Vibrate(duration);
                        }
                        catch (FeatureNotSupportedException ex)
                        {
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                if (countPin > 6)
                {
                    pin = pin.Substring(0, 5);
                    HintColorChange(pin.Length);
                }
            }
        }
        private async void CheckPin()
        {
            IsProcess = true;
            DateTime birthDate = new DateTime();

            error = null;
            int errorType = 0;

            try
            {
                var inputDateTime = DateTime.ParseExact(BirthDate, "dd/MM/yyyy", null);
                birthDate = Convert.ToDateTime(inputDateTime);
            }
            catch (Exception e)
            {
                error = "Invalid BirthDate format is\n Example : 25/12/2562";
            }
            bool checkEmailFormat = false;

            if (!string.IsNullOrEmpty(Email))
            {
                checkEmailFormat = Unities.CheckEmailFormat(Email);
            }
            if (!checkEmailFormat)
            {
                error += "\n Invalid Email Format";
            }
            if (!string.IsNullOrEmpty(error))
            {
                IsProcess = false;
                ErrorViewModel errorView = new ErrorViewModel(error, errorType);
                await PopupNavigation.Instance.PushAsync(new Error(errorView));
            }
            else
            {
                var resultCaller = await _pinService.CheckForgotPin(birthDate, Email);

                if (resultCaller == null || resultCaller.Model == null || string.IsNullOrEmpty(resultCaller.Model.RefNumber))
                {
                    error = "ขออภัย! ไม่พบอีเมลล์ที่กรอกในระบบ";
                }
                else if (resultCaller.IsError)
                {
                    error     = "ขออภัย! ไม่สามารถเชื่อมต่อได้";
                    errorType = 1;
                }
                else
                {
                    IsProcess = false;
                    string resultRefOtp = resultCaller.Model.RefNumber;
                    await PopupNavigation.Instance.PopAllAsync();

                    await Application.Current.MainPage.Navigation.PushAsync(new PinPage(new OtpForgotPassViewModel(Email, resultRefOtp, birthDate)));
                }
                if (!string.IsNullOrEmpty(error))
                {
                    IsProcess = false;
                    ErrorViewModel errorView = new ErrorViewModel(error, errorType);
                    await PopupNavigation.Instance.PushAsync(new Error(errorView));
                }
            }
        }
        public async void LoginByFingerprint()
        {
            var result = await CrossFingerprint.Current.AuthenticateAsync("Prove you have fingers!");

            if (result.Authenticated)
            {
                try
                {
                    var refreshToken = await SecureStorage.GetAsync("RefreshToken");;
                    var tokenData    = await _authService.GetTokenByRefreshToken(email, refreshToken);

                    if (tokenData != null || !tokenData.IsError)
                    {
                        if (tokenData.Model == null || tokenData.Model.Token == null)
                        {
                            ErrorViewModel errorViewModel = new ErrorViewModel("กรุณาเข้าสู่ระบบอีกครั้ง", (int)EW_Enumerations.EW_ErrorTypeEnum.Error, ForceLogoutForErrorPopup);
                            await PopupNavigation.Instance.PushAsync(new Error(errorViewModel));
                        }
                        else
                        {
                            await SecureStorage.SetAsync("Token", tokenData.Model.Token);

                            App.Account = await SecureStorage.GetAsync("Account");

                            App.Email = await SecureStorage.GetAsync("Email");

                            App.FirstName = await SecureStorage.GetAsync("FirstName");

                            App.LastName = await SecureStorage.GetAsync("LastName");

                            string preBirthDate = await SecureStorage.GetAsync("BirthDate");

                            try
                            {
                                App.BirthDate = DateTime.Parse(preBirthDate);
                            }
                            catch (Exception)
                            {
                            }
                            App.MobileNumber = await SecureStorage.GetAsync("MobileNumber");

                            int gender = 0;
                            int.TryParse(await SecureStorage.GetAsync("Gender"), out gender);
                            App.Gender = (EWalletV2.Api.ViewModels.EW_Enumerations.EW_GenderEnum)gender;
                            Application.Current.MainPage = new NavigationPage(new UserTabbedPage());
                        }
                    }
                    else
                    {
                        pin = "";
                        int countPin = pin.Length;
                        HintColorChange(countPin);
                        WarningText    = "ไม่สามารถเชื่อมต่อได้";
                        WarningVisible = true;
                        try
                        {
                            Vibration.Vibrate();
                            var duration = TimeSpan.FromSeconds(1);
                            Vibration.Vibrate(duration);
                        }
                        catch (FeatureNotSupportedException ex)
                        {
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorViewModel errorViewModel = new ErrorViewModel("โทรศัพท์ของท่านไม่สามารถใช้งานแอพพลิเคชั่นนี้ได้", (int)EW_Enumerations.EW_ErrorTypeEnum.Warning, CloseApp);
                    await PopupNavigation.Instance.PushAsync(new Error(errorViewModel));
                }
            }
            else
            {
                ErrorViewModel errorViewModel = new ErrorViewModel("ลายนิ้วมือไม่ถูกต้อง", (int)EW_Enumerations.EW_ErrorTypeEnum.Warning);
                await PopupNavigation.Instance.PushAsync(new Error(errorViewModel));
            }
        }
        public async Task Login()
        {
            var loginData = await _authService.LoginByCustomer(email, pin);

            if (loginData != null && !loginData.IsError)
            {
                if (loginData.Model != null)
                {
                    try
                    {
                        string gender    = ((int)loginData.Model.Gender).ToString();
                        string birthDate = loginData.Model.BirthDate.ToString("dd/MM/yyyy");
                        await SecureStorage.SetAsync("RefreshToken", loginData.Model.RefreshToken);

                        await SecureStorage.SetAsync("Token", loginData.Model.Token);

                        await SecureStorage.SetAsync("Account", loginData.Model.Account);

                        await SecureStorage.SetAsync("Email", email);

                        await SecureStorage.SetAsync("FirstName", loginData.Model.FirstName);

                        await SecureStorage.SetAsync("LastName", loginData.Model.LastName);

                        await SecureStorage.SetAsync("BirthDate", birthDate);

                        await SecureStorage.SetAsync("MobileNumber", loginData.Model.MobileNumber);

                        await SecureStorage.SetAsync("Gender", gender);

                        App.Account      = loginData.Model.Account;
                        App.Email        = email;
                        App.FirstName    = loginData.Model.FirstName;
                        App.LastName     = loginData.Model.LastName;
                        App.BirthDate    = loginData.Model.BirthDate;
                        App.MobileNumber = loginData.Model.MobileNumber;
                        App.Gender       = loginData.Model.Gender;
                        await Application.Current.MainPage.Navigation.PushAsync(new RegistAndFingerSuccess());
                    }
                    catch (Exception e)
                    {
                        ErrorViewModel errorViewModel = new ErrorViewModel("โทรศัพท์ของท่านไม่สามารถใช้งานแอพพลิเคชั่นนี้ได้", (int)EW_Enumerations.EW_ErrorTypeEnum.Warning, CloseApp);
                        await PopupNavigation.Instance.PushAsync(new Error(errorViewModel));
                    }
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Error", "ไม่สามารถ Register ได้", "OK");

                    await Application.Current.MainPage.Navigation.PopToRootAsync();
                }
            }
            else
            {
                WarningText    = "ไม่สามารถเชื่อมต่อได้";
                WarningVisible = true;
                try
                {
                    Vibration.Vibrate();
                    var duration = TimeSpan.FromSeconds(1);
                    Vibration.Vibrate(duration);
                }
                catch (FeatureNotSupportedException ex)
                {
                }
                catch (Exception ex)
                {
                }
            }
        }