public GetForgetPasswordMobileResponse getForgetPasswordMobileRequest(GetForgetPasswordMobileRequest forgetPasswordMobileRequest, string token)
        {
            GetForgetPasswordMobileResponse result = null;

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "RegistrationMobile/ForgotPassword");
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    var myContent   = JsonConvert.SerializeObject(forgetPasswordMobileRequest);
                    var buffer      = Encoding.UTF8.GetBytes(myContent);
                    var byteContent = new ByteArrayContent(buffer);
                    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");



                    var response = client.PostAsync(client.BaseAddress, byteContent).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        var responseStream = response.Content.ReadAsStringAsync().Result;
                        result = JsonConvert.DeserializeObject <GetForgetPasswordMobileResponse>(responseStream);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        private async void sendEmailBtn_Clicked(object sender, EventArgs e)
        {
            if (!new EmailAddressAttribute().IsValid(emailEntry.Text) || string.IsNullOrEmpty(emailEntry.Text))
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please enter a valid email address"));
            }
            else
            {
                forgetPasswordMobileRequest.email       = emailEntry.Text;
                forgetPasswordMobileRequest.clienTime   = DateTime.Now;
                forgetPasswordMobileRequest.callBackUrl = "";
                bool busy = false;
                if (!busy)
                {
                    try
                    {
                        busy = true;
                        await PopupNavigation.Instance.PushAsync(new LoadingPopup("Loading.."));

                        await Task.Run(() =>
                        {
                            forgetPasswordMobileResponse = getForgetPasswordMobileRequest(forgetPasswordMobileRequest, token);
                        });
                    }
                    finally
                    {
                        busy = false;
                        if (PopupNavigation.Instance.PopupStack.Count == 1)
                        {
                            await PopupNavigation.Instance.PopAllAsync();
                        }
                        else if (PopupNavigation.Instance.PopupStack.Count > 1)
                        {
                            if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                            {
                                await PopupNavigation.Instance.PopAllAsync();
                            }
                        }
                    }
                    if (forgetPasswordMobileResponse != null)
                    {
                        if (forgetPasswordMobileResponse.message.ErrorCode == "200")
                        {
                            if (forgetPasswordMobileResponse.retval != 0)
                            {
                                email = emailEntry.Text;
                                await PopupNavigation.Instance.PushAsync(new SuccessPopUp("An email has been sent with instructions on how to reset your password", 5, email));
                            }
                        }
                        else
                        {
                            await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup("No profile found for this email ID"));
                        }
                    }
                }
            }
        }
        public ForgetPasswordPage()
        {
            InitializeComponent();
            var assembly = typeof(LoginPage);

            forgetPasswordMobileResponse = null;
            forgetPasswordMobileRequest  = new GetForgetPasswordMobileRequest();
            token = Application.Current.Properties["currentToken"].ToString();
            //sendEmailBtn.ImageSource = ImageSource.FromResource("BespokeMobile.Assets.sendEmail.png", assembly);
        }