private void Client_Load(object sender, EventArgs e) { Control.CheckForIllegalCrossThreadCalls = false; clbOnlineList.Items.Add("All/None"); _client = new Core.Client(); _client.ConnectServer(_ip, _port, ConnectCallback, ReceiveCallback, SendBefore, ErrorCallback); }
private void btnSend_Click(object sender, EventArgs e) { if (btnSend.Text == "Connect") { _client = new Core.Client(); _client.ConnectServer(_ip, _port, ConnectCallback, ReceiveCallback, SendBefore, ErrorCallback); } else if (btnSend.Text == "Send") { if (tbSend.Text.Trim().Length > 0) { Send(); } } }
private void Connect() { try { var config = Global.LoadConfig(); _client = new Client(); _client.ConnectServer( IPAddress.Parse(config.Rows[0][Global.ASS_STRING].ToString()), int.Parse(config.Rows[0][Global.PORT_STRING].ToString()), ConnectCallback, ReceiveCallback, null, ErrorCallback); } catch (Exception ex) { MessageBox.Show("connect error:" + ex.Message, "error"); ReturnTitle(); } }