Example #1
0
        private void GetCID_Click(object sender, EventArgs e)
        {
            string iid          = this.iidInputTextBox.Text;
            string convertedIID = "";

            foreach (char i in iid)
            {
                if (i >= '0' && i <= '9')
                {
                    convertedIID += i;
                }
            }

            this.iidInputTextBox.Text = convertedIID;

            if (convertedIID == "")
            {
                this.cidOutputTextBox.Text = "IID must by not empty!";
                return;
            }

            this.iidInputTextBox.Enabled      = false;
            this.getCIDButton.Enabled         = false;
            this.getCIDButton.Text            = "Getting CID...";
            this.cidDashOutputTextBox.Text    = "";
            this.cidOutputTextBox.Text        = "";
            this.cidCommandOutputTextbox.Text = "";

            this.cidTimeLabel.Enabled = true;
            Application.DoEvents();

            string live_get = "false";

            if (this.checkBox1.Checked)
            {
                live_get = "true";
            }

            string cid = "";

            Thread t = new Thread(() =>
            {
                cid = Utils.GetCID(convertedIID, live_get);
            });

            t.Start();

            DateTime startTime = DateTime.Now;

            while (t.IsAlive)
            {
                this.UpdateCIDTimeLabel(startTime);
                Thread.Sleep(1);
            }

            this.iidInputTextBox.Enabled = true;
            this.getCIDButton.Enabled    = true;
            this.getCIDButton.Text       = "Get CID";

            if (cid == "")
            {
                this.cidOutputTextBox.Text = "Connect to server fail!";
                return;
            }

            this.cidOutputTextBox.Text = cid;
            this.updateCidDashOutput(cid);
            this.UpdateCIDComandOutput(null, null);
        }
Example #2
0
        private void LoginButtonClick(object sender, EventArgs e)
        {
            string email    = this.emailTextBox.Text;
            string password = this.passwordTextBox.Text;

            if (email == "" || password == "")
            {
                MessageBox.Show("User ID and Password must be not empty!", "Error");
                return;
            }

            this.loginStatusLabel.Show();
            this.loginStatusLabel.Text = "Logging in...";
            Application.DoEvents();

            try
            {
                var request = (HttpWebRequest)WebRequest.Create("");

                var postData = "email=" + Uri.EscapeDataString(email);
                postData += "&password="******"POST";
                request.ContentType   = "application/x-www-form-urlencoded";
                request.ContentLength = data.Length;

                using (var stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }

                var response = (HttpWebResponse)request.GetResponse();

                string   res    = new StreamReader(response.GetResponseStream()).ReadToEnd();
                string[] subRes = res.Split('\n');
                if (subRes[0] == "true")
                {
                    this.splitContainer1.Panel1.Hide();
                    this.splitContainer1.Panel2.Show();
                    this.loginStatusLabel.Hide();

                    MyForm.m_email    = email;
                    MyForm.m_password = password;

                    if (this.rememberAccountCheckbox.Checked)
                    {
                        Utils.saveAccount(email, password);
                    }

                    this.userEmailLabel.Text   = subRes[1]; //email
                    this.accountTypeLabel.Text = subRes[2];
                    this.expiredDateLabel.Text = subRes[3];

                    this.UpdateCounters();

                    this.SuspendLayout();
                    this.tabControl1.SuspendLayout();
                    this.tabControl1.TabPages.Insert(0, this.tabPage1);
                    this.tabControl1.TabPages.Insert(1, this.tabPage2);
                    this.tabControl1.TabPages.Insert(2, this.tabPage3);
                    this.tabControl1.PerformLayout();
                    this.PerformLayout();
                }
                else if (subRes[0] == "false")
                {
                    this.loginStatusLabel.Text = subRes[1];
                }
                else
                {
                    this.loginStatusLabel.Text = "Connect to server fail!";
                }
            }
            catch (Exception e1)
            {
                this.loginStatusLabel.Text = "Connect to server fail!";
            };
        }
Example #3
0
 private void MyForm_Shown(object sender, EventArgs e)
 {
     Utils.loadAccount(this.emailTextBox, this.passwordTextBox);
     CheckForUpdate();
 }