コード例 #1
0
ファイル: Form1.cs プロジェクト: AHTanvir/MetroIMWin
        private void button_login_Click(object sender, EventArgs e)
        {
            if (isAvailable())
            {
                String phone = phone_text.Text;
                String pass  = password_text.Text;
                Match  m     = reg.Match(phone);
                if (m.Success && pass.Length > 4)
                {
                    if (progress == null)
                    {
                        var context = TaskScheduler.FromCurrentSynchronizationContext();
                        progress       = new Progress();
                        progress.Owner = this;
                        progress.Show();
                        req = new HttpReqest();
                        Task newtask = Task.Factory.StartNew(() =>
                        {
                            res = req.sendAuthenticatioReqest(phone, pass, "cse");
                        }

                                                             ).ContinueWith(_ =>
                        {
                            progress.Close();
                            progress = null;
                            if (!res.Equals("0"))
                            {
                                Main main        = new Main(phone, pass, res);
                                main.FormClosed += new FormClosedEventHandler(mainClose);
                                main.Show();
                                this.Hide();
                            }
                            else
                            {
                                errorDilog.setMsg("Error", "Phone or Password does't match");
                                errorDilog.ShowDialog();
                            }
                        }, context);
                    }
                    else
                    {
                        progress.Activate();
                    }
                }
                else
                {
                    error_label.Text = "Invalid phone or password";
                }
            }
            else
            {
                errorDilog.setMsg("Error", "Internet connections are not available");
                errorDilog.ShowDialog();
            }
        }
コード例 #2
0
        void createJsonArray()
        {
            var json = JsonConvert.SerializeObject(
                new {
                StudentId = ids,
                Header    = mme,
                Result    = results
            });
            //var jsonSerialiser = new JavaScriptSerializer();
            //  var json = jsonSerialiser.Serialize(data);
            HttpReqest h   = new HttpReqest();
            String     res = h.sendNotice("+8801736549421", "anwar", "test", json, "cse", "result");

            Console.Write("Http Request callback " + res);
            //  Console.Write("jasson array " + res);
        }
コード例 #3
0
ファイル: Main.cs プロジェクト: AHTanvir/MetroIMWin
 public void setObject(ref object req)
 {
     this.req = (HttpReqest)req;
 }