Esempio n. 1
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (answer == userAns)
     {
         ToastPhoto.Source = new BitmapImage(new Uri("images/correct.png", UriKind.Relative));
         ToastPhoto.Visibility = Visibility.Visible;
         Story.Begin();
     }
     else
     {
         ToastPhoto.Source = new BitmapImage(new Uri("images/incorrect.png", UriKind.Relative));
         ToastPhoto.Visibility = Visibility.Visible;
         Story.Begin();
     }
     postAnswer.Add("uid", userAns);
     postAnswer.Add("publish", App.Check);
     PostClient pc = new PostClient(postAnswer);
     pc.DownloadStringCompleted += pc_DownloadStringCompleted;
     pc.DownloadStringAsync(new Uri("http://facebookfriendsquiz.appspot.com/choose", UriKind.Absolute));
     VarOneFrame.Source = new BitmapImage(new Uri("images/photo.png", UriKind.Relative));
     VarTwoFrame.Source = new BitmapImage(new Uri("images/photo.png", UriKind.Relative));
     VarThreeFrame.Source = new BitmapImage(new Uri("images/photo.png", UriKind.Relative));
     nextButton.IsEnabled = false;
     postAnswer.Clear();
     getQuestions();
 }
        public void get_chengjiu_list()
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("username", "8785169");

            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += (sender, e) =>
            {
                if (e.Error == null)
                {
                    JObject userobj = JObject.Parse(e.Result);

                    JArray userdata_info = (JArray)userobj["detail"];
                    my_chengjiu_detile a = new my_chengjiu_detile()
                    {
                        achiname = userdata_info[0]["achiname"].Value<string>(),
                        amount = userdata_info[0]["amount"].Value<string>(),
                        outline = "折翼天使"
                    };
                    detail.Add(a);

                    listbox_chengjiu.ItemsSource = detail;
                }

            };
            proxy.DownloadStringAsync(new Uri("http://cxds.sysu.me/user/achievement", UriKind.Absolute));
        }
Esempio n. 3
0
        public void login_message()
        {
            this.progressBar1.IsIndeterminate = true;
            this.progressBar1.Visibility = System.Windows.Visibility.Visible;
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("username", "8785169");
            parameters.Add("password", password.Text);
            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += (sender, e) =>
            {
                if (e.Error == null)
                {
                    JObject userobj = JObject.Parse(e.Result);
                    if (userobj["info"].ToString() == "success")
                    {
                        //NavigationService.Navigate(new Uri("/mail.xaml", UriKind.Relative));
                        this.progressBar1.IsIndeterminate = false;
                        this.progressBar1.Visibility = System.Windows.Visibility.Collapsed;
                        NavigationService.GoBack();
                    }
                }

            };
            proxy.DownloadStringAsync(new Uri("http://cxds.sysu.me/user/login", UriKind.Absolute));
        }
        private void btUpload_Click(object sender, RoutedEventArgs e)
        {
            //IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
            //var LocalData = ((List<ARunData>)settings["RunData"]);
            //var uploadData = new List<ARunUploadData>();
            //if (LocalData != null)
            //    foreach (var item in LocalData)
            //    {
            //        ARunUploadData a = new ARunUploadData();
            //        a.ParseFrom(item);
            //        uploadData.Add(a);
            //    }

            string jsonString = JsonConvert.SerializeObject(DateTime.Now.ToUniversalTime());

            //tbARunData.Text = jsonString;

            Dictionary<string, object> parameters = new Dictionary<string, object>();
            //parameters.Add("User", "admin");
            //parameters.Add("Password", "admin");
            //parameters.Add("RunData", jsonString);
            //var userInfo = (User)IsolatedStorageSettings.ApplicationSettings["UserInfo"];
            //parameters.Add("Gender", userInfo.gender);
            //parameters.Add("Weight", userInfo.weight);
            //parameters.Add("Age", userInfo.age);
            //parameters.Add("Grade", userInfo.grade*100);
            parameters.Add("name", "aaaanasmd");
            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += proxy_UploadDownloadStringCompleted;
            //Newtonsoft.Json.Converters.JavaScriptDateTimeConverter();
            proxy.DownloadStringAsync(new Uri("http://justrun.somee.com/login.aspx", UriKind.Absolute));
            //NavigationService.Navigate(new Uri("/DownloadDataTest.xaml",UriKind.Relative));
        }
Esempio n. 5
0
        public void DownloadFile(string fileName, Action<object, WindowsPhonePostClient.DownloadStringCompletedEventArgs> onCompleted)
        {
            IsolatedStorageFileStream input = new IsolatedStorageFileStream(fileName + ".gpx", System.IO.FileMode.OpenOrCreate, FileAccess.Read, File);
            StreamReader sm = new StreamReader(input);
            var content = sm.ReadToEnd();
            if (string.IsNullOrEmpty(content)) return;

            var postString = "content=" + Uri.EscapeDataString(Convert.ToBase64String(Encoding.UTF8.GetBytes(content)));
            PostClient client = new PostClient(postString);
            client.DownloadStringCompleted += new PostClient.DownloadStringCompletedHandler(onCompleted);
            client.DownloadStringAsync(new Uri("http://1010c.v2.ipc.la/"));
        }
        void weibolongin(string user, string password)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("username", "8785169");
            parameters.Add("password", "8785169");
            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += (sender, e) =>
            {
                if (e.Error == null)
                {
                    if (e.Result == "")
                    {
                        MessageBox.Show("亲,你的网络可能有问题了。");
                        this.progressBar1.IsIndeterminate = false;
                    }
                    else
                    {
                        try {
                            JObject userobj = JObject.Parse(e.Result);
                            if (userobj["info"].ToString() == "success")
                            {
                                this.progressBar1.IsIndeterminate = false;
                                this.progressBar1.Visibility = System.Windows.Visibility.Collapsed;
                                //if (((JObject)((JObject)userobj["detail"])["detail"]).ToString() == "[]")
                                //{
                                NavigationService.Navigate(new Uri("/daohang/weiboshouquan.xaml", UriKind.Relative));
                                //}
                                //else
                                //{
                                //    NavigationService.Navigate(new Uri("/main.xaml", UriKind.Relative));
                                //}
                            }
                            else
                            {
                                this.progressBar1.IsIndeterminate = false;
                                this.progressBar1.Visibility = System.Windows.Visibility.Collapsed;
                                MessageBox.Show("用户名或密码错误");
                            }
                        }
                        catch
                        {
                            MessageBox.Show("亲,你的网络可能有问题了。");

                            this.progressBar1.IsIndeterminate = false;
                            this.progressBar1.Visibility = System.Windows.Visibility.Collapsed;
                        }
                    }
                }

            };
            proxy.DownloadStringAsync(new Uri("http://cxds.sysu.me/user/login", UriKind.Absolute));
        }
        private void btDownload_Click(object sender, RoutedEventArgs e)
        {

            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("User", "ac");
            parameters.Add("Password", "ac");

            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += proxy_DownloadDownloadStringCompleted;

            proxy.DownloadStringAsync(new Uri("http://justrun.comlu.com/downloadData.php", UriKind.Absolute));

        }
        private void btSignIn_Click(object sender, RoutedEventArgs e)
        {
            prgBar.IsIndeterminate = true;
            prgBar.Visibility = Visibility.Visible;
            Rec.Visibility = Visibility.Visible;
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("User", tbUsername.Text.Trim());
            parameters.Add("Password", pwPassword.Password);

            PostClient signIn = new PostClient(parameters);
            signIn.DownloadStringCompleted += signIn_DownloadStringCompleted;
            signIn.DownloadStringAsync(new Uri("http://justrun.comlu.com/Login.php", UriKind.Absolute));
        }
        private void btSignUp_Click(object sender, RoutedEventArgs e)
        {
            if (pwPassword.Password == pwPasswordRetype.Password && pwPasswordRetype.Password == pwPassword.Password)
            {
                Dictionary<string, object> parameters = new Dictionary<string, object>();
                parameters.Add("User", tbUsername.Text.Trim());
                parameters.Add("Password", pwPassword.Password);
                parameters.Add("Email", tbEmail.Text);

                PostClient proxy = new PostClient(parameters);
                proxy.DownloadStringCompleted += proxy_DownloadStringCompleted;
                proxy.DownloadStringAsync(new Uri("http://justrun.comlu.com/SignUp.php", UriKind.Absolute));
            }
            else
                MessageBox.Show(AppResources.PasswordsNotMatch);

        }
        private void SendMail(object sender, RoutedEventArgs e)
        {
            if (TextValidator.IsValidEmail(txtEmail.Text))
            {
                Dictionary<string, object> parameters = new Dictionary<string, object>();
                parameters.Add("email", txtEmail.Text);

                PostClient proxy = new PostClient(parameters);

                proxy.DownloadStringCompleted += proxy_DownloadStringCompleted_SendMail;

                String urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/forgotpassword";
                proxy.DownloadStringAsync(new Uri(urlAddress, UriKind.Absolute));
            }
            else 
            {
                MessageBox.Show("Please fill in a valid email address", "Error", MessageBoxButton.OK);
            }
            
        }
        private void register()
        {

            bool isNetwork = NetworkInterface.GetIsNetworkAvailable();
            if (!isNetwork)
            {
                MessagePrompt prompt = new MessagePrompt();
                prompt.Title = "Error";

                prompt.Message = "Please check your internet connection";
                prompt.Show();

            }
            else
            {

                bool valid = true;
                if (!TextValidator.IsValidField(txtFirstname))
                {
                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";

                    prompt.Message = "Please enter your firstname";
                    prompt.Show();
                    valid = false;
                }
                else if (!TextValidator.IsValidField(txtLastname))
                {

                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";

                    prompt.Message = "Please enter your surname";
                    prompt.Show();
                    valid = false;


                }
                else if (!TextValidator.IsValidEmail(txtEmail.Text))
                {

                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";

                    prompt.Message = "Please enter a valid email address";
                    prompt.Show();
                    
                    valid = false;


                }
                else if (!TextValidator.IsValdidPassword(txtPassword))
                {
                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";

                    prompt.Message = "Please enter a password, minimum 5 chars";
                    prompt.Show();
                    
                    valid = false;


                }  

                if (valid)
                {
                    //register 
                    Dictionary<string, object> parameters = new Dictionary<string, object>();
                    parameters.Add("name", txtLastname.Text);
                    parameters.Add("email", txtEmail.Text);
                    parameters.Add("fname", txtLastname.Text);
                    parameters.Add("password", txtPassword.Text);
                    Language lang = (Language)languagePicker.SelectedItem;
                    
                    parameters.Add("language", lang.Taal);

                    if ((bool)chkNews.IsChecked)
                    {
                        parameters.Add("addtonews", 1);
                    }
                    else
                    {
                        parameters.Add("addtonews", 0);
                    }
                    
                    
                    PostClient proxy = new PostClient(parameters);
                    proxy.DownloadStringCompleted += proxy_DownloadStringCompleted;
                    String urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/adduser";
                    proxy.DownloadStringAsync(new Uri(urlAddress, UriKind.Absolute));
                    pgrLoader.Visibility = Visibility.Visible;

                }
            }

        }
Esempio n. 12
0
        // 心路历程信息获取
        public void get_message()
        {
            List<user> xinlu_list = new List<user>();
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("username", "8785169");
            parameters.Add("date", "2011/12/16");

            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += (sender, e) =>
            {
                if (e.Error == null)
                {
                    JObject userobj = JObject.Parse(e.Result);
                    int i = 2;
                    JObject userdata_info = (JObject)userobj["detail"];
                    JArray mess2011 = (JArray)userdata_info["1"];
                    JArray mess2012 = (JArray)userdata_info["2"];
                    int p = 0;
                    foreach (var obj in mess2011)
                    {
                        i = (i+2) % 4;
                        user a = new user()
                        {
                            pid = obj["id"].Value<string>(),
                            content = obj["content"].Value<string>(),
                            posttime = obj["posttime"].Value<string>(),
                            source = "",
                            source2 = "",
                            title = obj["title"].Value<string>(),
                            color1 = col[i],
                            color2 = col[i+1]
                        };
                        if (mess2012.Count == 0 || p > mess2012.Count - 1)
                        {
                            a.pid2 = "";
                            a.posttime2 = obj["posttime"].Value<string>();
                            a.content2 = "今天没有消息";
                        }
                        else
                        {
                            a.pid2 = mess2012[p]["id"].Value<string>();
                            a.posttime2 = mess2012[p]["posttime"].Value<string>();
                            a.content2 = mess2012[p]["content"].Value<string>();
                        }
                        p++;

                        xinlu_list.Add(a);
                    }

                    listBox_xinlu.ItemsSource = xinlu_list;
                }

            };
            proxy.DownloadStringAsync(new Uri("http://cxds.sysu.me/post/get", UriKind.Absolute));
        }
Esempio n. 13
0
        void input_Completed(object sender, PopUpEventArgs<string, PopUpResult> e)
        {
            if (e.Result != null)
            {
                InputPrompt p = (InputPrompt)sender;

                if (TextValidator.IsValidEmail(p.Value))
                {
                    Dictionary<string, object> parameters = new Dictionary<string, object>();
                    parameters.Add("email", p.Value);

                    PostClient proxy = new PostClient(parameters);

                    proxy.DownloadStringCompleted += proxy_DownloadStringCompleted_SendMail;

                    String urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/forgotpassword";
                    proxy.DownloadStringAsync(new Uri(urlAddress, UriKind.Absolute));
                }
                else
                {
              
                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";
                    prompt.Message = "Please fill in a valid email address";
                    prompt.Show();
                }
            }
        }
Esempio n. 14
0
        private void RequestServer()
        {
            
            
            if (m.Gender.Equals("M"))
            {
                Male male = (Male)m;
                Dictionary<string, object> parameters = new Dictionary<string, object>();
                parameters.Add("gender", "M");
                parameters.Add("cm", male.Cm);
                parameters.Add("age", male.Age);
                parameters.Add("weight", male.Weight);
                parameters.Add("height", male.Height);
                parameters.Add("collarsize", male.CollarSize);

                PostClient proxy = new PostClient(parameters);
                proxy.DownloadStringCompleted += proxy_DownloadStringCompleted;
                String urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/calcmale";
                proxy.DownloadStringAsync(new Uri(urlAddress, UriKind.Absolute));
            }
            else if (m.Gender.Equals("F"))
            {
                txtBelly.Visibility = Visibility.Collapsed;
                txtCollar.Visibility = Visibility.Collapsed;
                txtChest.Visibility = Visibility.Collapsed;
                lblBelly.Visibility = Visibility.Collapsed;
                lblCollar.Visibility = Visibility.Collapsed;
                lblChest.Visibility = Visibility.Collapsed;

                btnChest.Visibility = Visibility.Collapsed;
                btnCollar.Visibility = Visibility.Collapsed;
                btnBelly.Visibility = Visibility.Collapsed;

                btnUpperbust.Visibility = Visibility.Visible;
                btnUnderbust.Visibility = Visibility.Visible;
                btnHips.Visibility = Visibility.Visible;

                txtUpperbust.Visibility = Visibility.Visible;
                txtUnderbust.Visibility = Visibility.Visible;
                txtHips.Visibility = Visibility.Visible;
                lblUpperbust.Visibility = Visibility.Visible;
                lblUnderbust.Visibility = Visibility.Visible;
                lblHips.Visibility = Visibility.Visible;

                Female female = (Female)m;
                Dictionary<string, object> parameters = new Dictionary<string, object>();
                parameters.Add("gender", "F");
                parameters.Add("cm", female.Cm);
                parameters.Add("age", female.Age);
                parameters.Add("weight", female.Weight);
                parameters.Add("height", female.Height);
                parameters.Add("cup", female.CupSize);
                parameters.Add("arm", female.ArmLength);
                parameters.Add("waist", female.WaistSize);
                parameters.Add("hip", female.HipSize);

                PostClient proxy = new PostClient(parameters);
                proxy.DownloadStringCompleted += proxy_DownloadStringCompleted;
                String urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/calcfemale";
                proxy.DownloadStringAsync(new Uri(urlAddress, UriKind.Absolute));

            }
        }
Esempio n. 15
0
        private void login()
        {
            pgrLoader.Visibility = Visibility.Visible;
            
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("email", txtEmail.Text);
            parameters.Add("password", txtPassword.Text);

            PostClient proxy = new PostClient(parameters);

            proxy.DownloadStringCompleted += proxy_DownloadStringCompleted_Login;

            String urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/login";
            proxy.DownloadStringAsync(new Uri(urlAddress, UriKind.Absolute));
          
     

        }
Esempio n. 16
0
        private void SendMail() 
        {

            pgrLoader.Visibility = Visibility.Visible;

            string size = "";
            if (m.Cm.Equals("1"))
                {
                    size = "cm";
                }
                else
                {
                    size = "inches";
                }
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            String urlAddress = "";
            if (txtUpperbust.Visibility == Visibility.Visible) 
            {
                FemaleResult result = new FemaleResult();
                parameters.Add("email",txtEmail.Text.Replace(" " + size, ""));
                parameters.Add("underbust", txtUnderbust.Text.Replace(" " + size, ""));
                parameters.Add("upperbust", txtUpperbust.Text.Replace(" " + size, ""));
                parameters.Add("hip", txtHips.Text.Replace(" " + size, ""));
                parameters.Add("sleeve", txtSleeve.Text.Replace(" " + size, ""));
                parameters.Add("shoulder", txtShoulder.Text.Replace(" " + size, ""));
                parameters.Add("arm", txtArm.Text.Replace(" " + size, ""));
                parameters.Add("wrist", txtWrist.Text.Replace(" " + size, ""));
                parameters.Add("waist", txtWaist.Text.Replace(" " + size, ""));
                parameters.Add("back", txtBack.Text.Replace(" " + size, ""));
                parameters.Add("predicted", txtPrediction.Text);
                
               
                urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/female";
            }
            else
            {
                MaleResult result = new MaleResult();
                parameters.Add("email", txtEmail.Text.Replace(" " + size, ""));
                parameters.Add("belly", txtBelly.Text.Replace(" " + size, ""));
                parameters.Add("chest", txtChest.Text.Replace(" " + size, ""));
                parameters.Add("collar", txtCollar.Text.Replace(" " + size, ""));
                parameters.Add("sleeve", txtSleeve.Text.Replace(" " + size, ""));
                parameters.Add("shoulder", txtShoulder.Text.Replace(" " + size, ""));
                parameters.Add("arm", txtArm.Text.Replace(" " + size, ""));
                parameters.Add("wrist", txtWrist.Text.Replace(" " + size, ""));
                parameters.Add("waist", txtWaist.Text.Replace(" " + size, ""));
                parameters.Add("back", txtBack.Text.Replace(" " + size, ""));
                parameters.Add("predicted", txtPrediction.Text);
              
                urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/male";

      
            }

            if (m.Cm.Equals("1"))
            {
                parameters.Add("size", "cm");
            }
            else
            {
                parameters.Add("size", "inch");
            }

            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += proxy_DownloadStringCompleted_SendMail;
            proxy.DownloadStringAsync(new Uri(urlAddress, UriKind.Absolute));
        }
        void weibolongin(string user, string password)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("username", "8785169");
            parameters.Add("type", "weibo");
            parameters.Add("token", App.AccessToken);
            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += (sender, e) =>
            {
                if (e.Error == null)
                {
                    if (e.Result == "")
                    {
                        MessageBox.Show("亲,你的网络可能有问题了。");
                    }
                    else
                    {
                        try
                        {
                            JObject userobj = JObject.Parse(e.Result);
                            if (userobj["info"].ToString() == "success")
                            {
                                MessageBox.Show("微博授权成功,可以进入应用了,也可以进行人人授权");
                            }
                        }
                        catch
                        {
                            MessageBox.Show("亲,你的网络可能有问题了。");
                        }
                    }
                }

            };
            proxy.DownloadStringAsync(new Uri("http://cxds.sysu.me/user/impower", UriKind.Absolute));
        }
        private void UploadData(List<ARunData> totalData, string user, string password)
        {
            prgBar.IsIndeterminate = true;
            prgBar.Visibility = Visibility.Visible;
            Rec.Visibility = Visibility.Visible;
            tbSyncing.Visibility = Visibility.Visible;
            var uploadData = new List<ARunUploadData>();
            if (totalData != null && totalData.Count > 0)
                foreach (var item in totalData)
                {
                    ARunUploadData a = new ARunUploadData();
                    a.ParseFrom(item);
                    uploadData.Add(a);
                }

            string jsonString = JsonConvert.SerializeObject(uploadData);

            Dictionary<string, object> parameters = new Dictionary<string, object>();

            parameters.Add("User", user);
            parameters.Add("Password", password);
            parameters.Add("RunData", jsonString);
            var userInfo = (User)IsolatedStorageSettings.ApplicationSettings["UserInfo"];
            parameters.Add("Gender", userInfo.gender);
            parameters.Add("Weight", userInfo.weight);
            parameters.Add("Age", userInfo.age);
            parameters.Add("Grade", userInfo.grade * 100);

            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += proxy_UploadDownloadStringCompleted;
            //Newtonsoft.Json.Converters.JavaScriptDateTimeConverter();
            proxy.DownloadStringAsync(new Uri("http://justrun.comlu.com/uploadData.php", UriKind.Absolute));
            //NavigationService.Navigate(new Uri("/DownloadDataTest.xaml",UriKind.Relative));
            if (totalData.Count != 0)
            {
                IsolatedStorageSettings.ApplicationSettings["RunData"] = totalData;
                IsolatedStorageSettings.ApplicationSettings.Save();
            }
        }
        public void SyncData(string user, string password)
        {
            prgBar.IsIndeterminate = true;
            prgBar.Visibility = Visibility.Visible;
            Rec.Visibility = Visibility.Visible;
            tbSyncing.Visibility = Visibility.Visible;
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("User", user);
            parameters.Add("Password", password);

            PostClient proxy = new PostClient(parameters);
            proxy.DownloadStringCompleted += proxy_DownloadDownloadStringCompleted;

            proxy.DownloadStringAsync(new Uri("http://justrun.comlu.com/downloadData.php", UriKind.Absolute));
        }