Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (connBtn.Text == "开始连接")
            {

                var user = new Protocol.User();
                user.name = (this.nameBox.Text.Trim().Length > 0 ? this.nameBox.Text.Trim() : "Client_" + new Random().Next(9999));
                user.pwd = ">>密码<<";
                user.role = "管理员";
                user.auth = "xxxxxxxxx";
                user.id = Guid.NewGuid();
                client = new NotifyClient(user.MakeAuthCode());

                this.connBtn.Text = "关闭连接";
            }
            else
            {
                if (this.client!=null)
                {
                    this.client.Stop();
                    this.connBtn.Text = "开始连接";
                }
            }
            
        }