public MainPage() { InitializeComponent(); StringBuilder postData = new StringBuilder(); WebClient webClient = new WebClient(); var tsLong = DateTime.Now.Millisecond / 1000; webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; var uri = new Uri("URL"); postData.AppendFormat("{0}={1}", "className", HttpUtility.UrlEncode("ebuskiMobile")); postData.AppendFormat("{0}={1}", "methodName", HttpUtility.UrlEncode("m_getContents")); postData.AppendFormat("{0}={1}", "osName", HttpUtility.UrlEncode("Windows")); postData.AppendFormat("{0}={1}", "osVersion", HttpUtility.UrlEncode("1.0")); postData.AppendFormat("{0}={1}", "appVersion", HttpUtility.UrlEncode("1.0")); postData.AppendFormat("{0}={1}", "width", HttpUtility.UrlEncode("1080")); postData.AppendFormat("{0}={1}", "height", HttpUtility.UrlEncode("1200")); webClient.Headers[HttpRequestHeader.ContentLength] = postData.Length.ToString(); webClient.UploadStringCompleted += new UploadStringCompletedEventHandler(webClient_UploadRegisterStringCompleted); // webClient.UploadProgressChanged += webClient_UploadRegisterProgressChanged; webClient.UploadStringAsync(uri, "POST", postData.ToString()); } public class RootObject { public string message { get; set; } } private void webClient_UploadRegisterStringCompleted(object sender, UploadStringCompletedEventArgs e) { //exeption here string jsonstring = e.Result; RootObject rootobj = new RootObject(); MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonstring)); DataContractJsonSerializer ser = new DataContractJsonSerializer(rootobj.GetType()); rootobj = ser.ReadObject(ms) as RootObject; string status = rootobj.message; MessageBox.Show(status); // NavigationService.Navigate(new Uri("/MISTFMGE;component/Views/Login.xaml", UriKind.RelativeOrAbsolute)); IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; } private void btnSkip_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate( new Uri("/EntryPoll.xaml", UriKind.Relative)); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)