Пример #1
0
        private void button5_Click(object sender, System.EventArgs e)
        {
            string result;

            result = this.websrv.Force(this.textBox1.Text.Trim(), this.textBox2.Text);
            if (result.CompareTo("Thread error !!!") == 0)
            {
                this.label3.Text = result;
            }
            else if (result.CompareTo("XML file error !!!") == 0)
            {
                this.label3.Text = result;
            }
            else
            {
                string newusers, key;
                int    i;
                i                    = result.IndexOf("#");
                newusers             = result.Substring(i + 1);
                key                  = result.Substring(0, i);
                this.label3.Text     = "";
                this.button5.Visible = false;
                currentkey           = Convert.ToInt32(key);
                MessageBox.Show(newusers + " New user(s) signin.");
                this.Visible                = false;
                this.controlform            = new control();
                controlform.currentusername = this.textBox1.Text.Trim();
                controlform.currentpassword = this.textBox2.Text;
                controlform.currentkey      = this.currentkey;
                controlform.websrv          = this.websrv;
                this.textBox1.Text          = null;
                this.textBox2.Text          = null;
                this.controlform.ShowDialog();
                this.Close();
            }
        }
Пример #2
0
        private void button2_Click(object sender, System.EventArgs e)
        {
            string result;

            this.button5.Visible = false;
            this.label3.Text     = "Please wait...";
            result = this.websrv.Connect(this.textBox1.Text.Trim(), this.textBox2.Text);
            if (result.CompareTo("Divice is being used by another user !!!") == 0)
            {
                this.label3.Text = result;
            }
            else if (result.CompareTo("You haven't Permission !!!") == 0)
            {
                this.label3.Text = result;
            }
            else if (result.CompareTo("Thread error !!!") == 0)
            {
                this.label3.Text = result;
            }
            else if (result.CompareTo("Invalid username or password !!!") == 0)
            {
                this.textBox2.Text = null;
                this.textBox2.Focus();
                this.label3.Text = result;
            }
            else if (result.CompareTo("XML file error !!!") == 0)
            {
                this.label3.Text = result;
            }
            else if (this.textBox1.Text.Trim().CompareTo("Administrator") == 0)
            {
                if (result.Length > 30)
                {
                    string message, user;
                    int    i;
                    this.button5.Visible = true;
                    i                = result.IndexOf(":");
                    user             = result.Substring(i + 1);
                    message          = result.Substring(0, i);
                    this.label3.Text = message + " :\n" + user;
                }
                else
                {
                    string newusers, key;
                    int    i;
                    i        = result.IndexOf("#");
                    newusers = result.Substring(i + 1);
                    key      = result.Substring(0, i);
                    if (newusers != null)
                    {
                        this.label3.Text = "";
                        currentkey       = Convert.ToInt32(key);
                        MessageBox.Show(newusers + " New user(s) signin.");
                        this.Visible                = false;
                        this.controlform            = new control();
                        controlform.currentusername = this.textBox1.Text.Trim();
                        controlform.currentpassword = this.textBox2.Text;
                        controlform.currentkey      = this.currentkey;
                        controlform.websrv          = this.websrv;
                        this.textBox1.Text          = null;
                        this.textBox2.Text          = null;
                        this.controlform.ShowDialog();
                        this.Close();
                    }
                }
            }
            else
            {
                this.label3.Text            = "";
                currentkey                  = Convert.ToInt32(result);
                this.controlform            = new control();
                controlform.currentusername = this.textBox1.Text.Trim();
                controlform.currentpassword = this.textBox2.Text;
                controlform.currentkey      = this.currentkey;
                controlform.websrv          = this.websrv;
                this.Visible                = false;
                this.textBox1.Text          = null;
                this.textBox2.Text          = null;
                this.controlform.ShowDialog();
                this.Close();
            }
        }