private async void RegisterButton_Clicked(object sender, EventArgs e) { NoInternet.IsVisible = false; Loader.IsVisible = true; await Task.Delay(1000); HttpRequestWrapper wrapper = new HttpRequestWrapper(); List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); CameraViewModel RegModel = new CameraViewModel(); if (ChkNullAll() == true) { MultipartFormDataContent formdata = new MultipartFormDataContent(); formdata.Add(new StringContent(Name.Text.Trim()), "user_name"); formdata.Add(new StringContent(PhoneNo.Text), "phone_no"); formdata.Add(new StringContent(string.IsNullOrEmpty(EmailId.Text) ? "" : EmailId.Text), "email_id"); //formdata.Add(new StringContent(password.Text.Trim()), "password"); formdata.Add(new StringContent(CityId), "city_id"); formdata.Add(new StringContent(string.IsNullOrEmpty(ReferCode.Text) ? "" : ReferCode.Text), "referral_code"); formdata.Add(new StringContent(Constant.CompanyID), "company_code"); formdata.Add(new StringContent(Constant.DeviceType), "device_type"); formdata.Add(new StringContent(AppData.DeviceToken), "device_token"); formdata.Add(new StringContent(Constant.AppVersion), "app_version"); //formdata.Add(new StringContent(Data, Encoding.UTF8, "application/json")); if (ProfileImage != null) { formdata.Add(new StreamContent(new MemoryStream(ProfileImage)), "profile_image", ImageSourceName.Text); } try { string items = await wrapper.PostFormDataAsync(Constant.APIs[(int)Constant.APIName.Registration], formdata); if (items.ToString() == "NoInternet") { NoInternet.IsVisible = true; MainFrame.IsVisible = false; logoimg.IsVisible = false; name.IsVisible = false; Phone.IsVisible = false; photo.IsVisible = false; email.IsVisible = false; cityList.IsVisible = false; button.IsVisible = false; SkipLogin.IsVisible = false; social.IsVisible = false; } else { try { des = JsonConvert.DeserializeObject <jsonResponseClass>(items); } catch { await DisplayAlert("Internal server error", "Please try again later", "Cancel"); } if (des.responseText == "Success") { var userid = des.data.user_id.ToString(); await Navigation.PushModalAsync(new OTPValidationPage(userid)); } else { await DisplayAlert("Error", "Please check input data you provided", "OK", "Cancel"); } } } catch (Exception ex) { } } MainFrame.IsVisible = true; Loader.IsVisible = false; }
private async void SubmitButton_Clicked(object sender, EventArgs e) { //App.Current.MainPage = new MasterDetailsPage(); Loader.IsVisible = true; MainFrame.IsVisible = false; LogoImg.IsVisible = false; await Task.Delay(1000); if (AppData.UserId != null) { HttpRequestWrapper wrapper = new HttpRequestWrapper(); List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); if (!IsPasswordsEqual(Password.Text, RePassword.Text)) { await DisplayAlert("Error", "Re-password does not matched!!", "Cancel"); } else { if (ChkNullAll() == true) { parameters.Add(new KeyValuePair <string, string>("company_code", Constant.CompanyID)); parameters.Add(new KeyValuePair <string, string>("user_id", AppData.UserId)); parameters.Add(new KeyValuePair <string, string>("current_password", CurrentPassword.Text)); parameters.Add(new KeyValuePair <string, string>("new_password", Password.Text)); try { string data = await wrapper.GetResponseAsync(Constant.APIs[(int)Constant.APIName.ChangePassword], parameters); if (data.ToString() == "NoInternet") { NoInternet.IsVisible = true; MainFrame.IsVisible = false; LogoImg.IsVisible = false; } else { try { des = JsonConvert.DeserializeObject <jsonResponseClass>(data); } catch { await DisplayAlert("Internal server error", "Please try again later", "Cancel"); } if (des.responseText == "Success") { await DisplayAlert("Success", "Password has been changed successfully", "OK"); App.Current.MainPage = new MasterDetailsPage(); } else { await DisplayAlert("Error", des.responseText, "Cancel"); } } } catch (Exception ex) { } } } } Loader.IsVisible = false; MainFrame.IsVisible = true; LogoImg.IsVisible = true; }