private void btnRegister_Click(object sender, RoutedEventArgs e) { if (Validation() == true) { // show Loader myIndeterminateProbar.Visibility = Visibility.Visible; // Parameters RegistrationRequest obj = new RegistrationRequest(); obj.firstName = txtFirstName.Text.Trim(); obj.lastName = txtLastName.Text.Trim(); obj.email = txtEmail.Text.Trim(); obj.userName = txtUserName.Text.Trim(); obj.organizationName = txtBusinessName.Text.Trim(); obj.businessPhone = Convert.ToInt64(txtBusinessPhone.Text.Trim()); // Write user details if (ISOFile.FileExists("SignUpFirstPageDetails")) { ISOFile.DeleteFile("SignUpFirstPageDetails"); } using (IsolatedStorageFileStream fileStream = ISOFile.OpenFile("SignUpFirstPageDetails", FileMode.Create)) { DataContractSerializer serializer = new DataContractSerializer(typeof(RegistrationRequest)); serializer.WriteObject(fileStream, obj); // show Loader myIndeterminateProbar.Visibility = Visibility.Visible; // Redirect to home page NavigationService.Navigate(new Uri("/Views/SignUpSecondPage.xaml", UriKind.Relative)); } } }
private void Button_Click(object sender, RoutedEventArgs e) { if (ISOFile.FileExists("SignUpFirstPageDetails"))//read current SignUp First Page Details { using (IsolatedStorageFileStream fileStream = ISOFile.OpenFile("SignUpFirstPageDetails", FileMode.Open)) { DataContractSerializer serializer = new DataContractSerializer(typeof(RegistrationRequest)); var ObjSignUpFirstPageData = (RegistrationRequest)serializer.ReadObject(fileStream); // Parameters RegistrationRequest obj = new RegistrationRequest(); //First Screen obj.firstName = ObjSignUpFirstPageData.firstName; obj.lastName = ObjSignUpFirstPageData.lastName; obj.email = ObjSignUpFirstPageData.email; obj.userName = ObjSignUpFirstPageData.userName; obj.organizationName = ObjSignUpFirstPageData.organizationName; obj.businessPhone = ObjSignUpFirstPageData.businessPhone; // clear session info var Settings = IsolatedStorageSettings.ApplicationSettings; Settings.Remove("SignUpFirstPageDetails"); //Second Screen ListPickerItem selectedItemState = this.listPickerState.ItemContainerGenerator.ContainerFromItem(this.listPickerState.SelectedItem) as ListPickerItem; data_State SelecteddataState = selectedItemState.DataContext as data_State; obj.state = Convert.ToInt32(SelecteddataState.stateId); ListPickerItem selectedItemArea = this.listPickerArea.ItemContainerGenerator.ContainerFromItem(this.listPickerArea.SelectedItem) as ListPickerItem; data_Area SelecteddataArea = selectedItemArea.DataContext as data_Area; obj.area = Convert.ToInt32(SelecteddataArea.areaId); ListPickerItem selectedItemCity = this.listPickerCity.ItemContainerGenerator.ContainerFromItem(this.listPickerCity.SelectedItem) as ListPickerItem; data_City SelecteddatCity = selectedItemCity.DataContext as data_City; obj.city = Convert.ToInt32(SelecteddatCity.zipId); // here zipId is cityID obj.addressLine1 = txtStreet.Text.Trim(); obj.password = txtPassword.Password.Trim(); obj.isPointeMart = (chkRequest.IsChecked == true) ? 1 : 0; obj.isPointePay = 1; // Always 1 since app itself is PointePay obj.country = _countryId; // id of country (nigeria only) obj.businessPhoneCode = _businessPhoneCode; //must add + before code e.g. +234 String data = "firstName=" + obj.firstName + "&lastName=" + obj.lastName + "&email=" + obj.email + "&userName="******"&organizationName=" + obj.organizationName + "&businessPhone=" + obj.businessPhone + "&state=" + obj.state + "&area=" + obj.area + "&city=" + obj.city + "&addressLine1=" + obj.addressLine1 + "&password="******"&isPointeMart=" + obj.isPointeMart + "&isPointePay=" + obj.isPointePay + "&country=" + obj.country + "&businessPhoneCode=" + obj.businessPhoneCode; if (Validation() == true) { // Show Loader myIndeterminateProbar.Visibility = Visibility.Visible; //Initialize WebClient WebClient webClient = new WebClient(); //Set Header webClient.Headers[HttpRequestHeader.Authorization] = Utilities.GetAuthorization(); webClient.Headers["Content-Type"] = "application/x-www-form-urlencoded"; webClient.Headers[HttpRequestHeader.AcceptLanguage] = "en_US"; webClient.UploadStringAsync(new Uri("http://54.173.246.245/marketplace/api/auth/signUp/"), "POST", data); //Assign Event Handler webClient.UploadStringCompleted += wc_UploadStringCompleted; } } } }