Beispiel #1
0
        private void button_User_Click(object sender, EventArgs e)
        {
            User      person = new User(int.Parse(uid), uac, ucl, upw);
            Form_User user   = new Form_User(person);

            user.ReturnUser += (o, e1) =>
            {
                if (!e1.CanUpdate)
                {
                    return;
                }
                User now = e1.Me;
                // 更新资料
                string     question = "Change " + now.GetRawString(), answer;
                TcpClientP request = new TcpClientP();
                request.Connect(serverIP, Port.TCP_LOGIN_PORT);
                request.Query(question, out answer);
                if (answer != VerMessage.CHANGE_SUCCESS)
                {
                    MessageBox.Show("更新信息失败", "提示", MessageBoxButtons.OK);
                    request.Close();
                    return;
                }
                MessageBox.Show("更新信息成功", "提示", MessageBoxButtons.OK);
                request.Close();
                ucl = now.name;
                Registry.AddKey2Registry("PublishClient", "CurrentUserName", ucl);
                this.Text = "教材补助经费评估软件 [" + ucl + "]" + " [#" + uid + "]";
                this.label_ClientName.Text = "[#" + uid + "] " + ucl;
            };
            user.ShowDialog();
        }
Beispiel #2
0
 private void button_User_Click(object sender, EventArgs e)
 {
     User person = new User(int.Parse(uid), uac, ucl, upw);
     Form_User user = new Form_User(person);
     user.ReturnUser += (o, e1) =>
     {
         if (!e1.CanUpdate) return;
         User now = e1.Me;
         // 更新资料
         string question = "Change " + now.GetRawString(), answer;
         TcpClientP request = new TcpClientP();
         request.Connect(serverIP, Port.TCP_LOGIN_PORT);
         request.Query(question, out answer);
         if (answer != VerMessage.CHANGE_SUCCESS)
         {
             MessageBox.Show("更新信息失败", "提示", MessageBoxButtons.OK);
             request.Close();
             return;
         }
         MessageBox.Show("更新信息成功", "提示", MessageBoxButtons.OK);
         request.Close();
         ucl = now.name;
         Registry.AddKey2Registry("PublishClient", "CurrentUserName", ucl);
         this.Text = "教材补助经费评估软件 [" + ucl + "]" + " [#" + uid + "]";
         this.label_ClientName.Text = "[#" + uid + "] " + ucl;
     };
     user.ShowDialog();
 }