Exemplo n.º 1
0
        private void bt_Start_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text == "公共会话")
            {
                MessageBox.Show("名称不合法", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (this.textBox1.Text.Contains("@"))
            {
                MessageBox.Show("名称不能包含特殊字符", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (textBox1.Text.Length > 6)
            {
                MessageBox.Show("昵称长度不能超过6个字符", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (textBox1.Text.Trim() == "")
            {
                textBox1.Text = null;
                MessageBox.Show("昵称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (Method.Audit(this.textBox1.Text))
            {
                textBox1.Text = "大家都是我爸";
            }
            textBox1.Text = textBox1.Text.Replace(" ", "");
            this.channel  = comboBox1.SelectedIndex + 1; //绑定频道
            this.userName = textBox1.Text;               //绑定昵称

            KeyData.StaticInfo.MyUser = new Model.UserData(this.ip, this.userName, this.imgid, this.channel);
            KeyData.receiver.UserOnlineAndOfflineEvent -= Receiver_UserOnlineAndOfflineEvent;
            Transmitters.Sender.StopSendAllTest();
            KeyData.form1 = new Form1();
            this.Hide();
            KeyData.form1.ShowDialog();
            this.Close();
            this.Dispose();
        }