예제 #1
0
파일: LogOn.cs 프로젝트: 12345fish/ZYNet
        private async void button1_Click(object sender, EventArgs e)
        {
            var res = await ClientManager.NewAsync().Get <ServerMethods>().LogOn(this.textBox1.Text);

            var isOK = res?.First?.Value <bool>();

            if (isOK != null)
            {
                if (isOK.Value)
                {
                    this.BeginInvoke(new EventHandler(delegate
                    {
                        this.Close();
                    }));
                }
                else
                {
                    MessageBox.Show(res[1].Value <string>());
                }
            }
        }
예제 #2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            if (this.comboBox1.SelectedIndex == 0)
            {
                ClientManager.Sync.Get <ServerMethods>().SendMessageToAllUser(this.textBox1.Text);
            }
            else
            {
                var userinfo = this.comboBox1.SelectedItem as UserInfo;

                if (userinfo != null)
                {
                    var msgres = await ClientManager.NewAsync().Get <ServerMethods>().SendMsgToUser(userinfo.UserName, this.textBox1.Text);

                    var msg = msgres?.First?.Value <string>();


                    this.BeginInvoke(new EventHandler(delegate
                    {
                        this.richTextBox1.AppendText((userinfo.UserName + ":" + msg ?? "发送失败") + "\r\n");
                    }));
                }
            }
        }