Exemple #1
0
        private void Main_Uploaded(object sender, System.Windows.RoutedEventArgs e)

        {
            this.UploadPan.Visibility = System.Windows.Visibility.Collapsed;
            string url = "http://95.85.15.223/dotnet/save.php";

            Uri uri = new Uri(url);
            string alldata = null;
            if (this.listpicker.SelectedIndex == 0)
                alldata = JsonConvert.SerializeObject(App.ViewModel.AllDataItems);
            else if (this.listpicker.SelectedIndex == 1)
                alldata = JsonConvert.SerializeObject(App.ClViewModel.AllClockItems);
            else if (this.listpicker.SelectedIndex == 2)
                alldata = JsonConvert.SerializeObject(App.CViewModel.AllCountItems);
            else
                alldata = JsonConvert.SerializeObject(App.DViewModel.AllDataItems);
          
            
            // string alldata = "{\"password\":\""+ up_password.Text+"\",\"json\":\"ok\",\"status\":\"1\",\"link\":\"http://kuaidi100.com/chaxun?com=yuantong&nu=1780371398\",\"state\":\"3\",\"data\":[{\"time\":\"2012-03-19 15:02:42\",\"context\":\"河南省南阳市白河南/PDA正常签收扫描/签收人:孟星星 \"}]}";
            client = new WebClient();
            client.Headers["Content-Type"] = "application/x-www-form-urlencoded";
            client.Encoding = Encoding.UTF8;
            client.AllowReadStreamBuffering = true;
            client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompleted);
            Parameters prms = new Parameters();
            prms.AddPair("password", up_password.Text);
            prms.AddPair("json", alldata);

            client.UploadStringAsync(uri,"POST", prms.FormPostData(), null);


        }
Exemple #2
0
        private void Main_Downloaded(object sender, System.Windows.RoutedEventArgs e)
        {
            this.DownloadPan.Visibility = System.Windows.Visibility.Collapsed;
            string url = "http://95.85.15.223/dotnet/load.php";
            Uri uri = new Uri(url);

            client = new WebClient();
            client.Headers["Content-Type"] = "application/x-www-form-urlencoded";
            client.Encoding = Encoding.UTF8;
            client.AllowReadStreamBuffering = true;
            
            Parameters prms = new Parameters();
            prms.AddPair("password",down_password.Text);
            prms.AddPair("id",down_id.Text);
            client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompleted);
            client.UploadStringAsync(uri,"POST",prms.FormPostData(),null);

      
        }