private void _Connect() { server = null; account = null; bool bCheckOk = false; do { if (0 == serversList.Count) { MessageBox.Show("您还没有设置 服务器 信息,目前只选择第一条进行连接"); break; } if (0 == accountsList.Count) { MessageBox.Show("您还没有设置 账号 信息,目前只选择第一条进行连接"); break; } server = serversList[0]; account = accountsList[0]; if (string.IsNullOrEmpty(server.Address)) { MessageBox.Show("Address不能为空"); break; } if (0 == server.Port) { MessageBox.Show("Port不能为空"); break; } if (string.IsNullOrEmpty(account.InvestorId) || string.IsNullOrEmpty(account.Password)) { MessageBox.Show("账号信息不全"); break; } bCheckOk = true; } while (false); if (false == bCheckOk) { ChangeStatus(ProviderStatus.Disconnected); isConnected = false; return; } ChangeStatus(ProviderStatus.Connecting); //如果前面一次连接一直连不上,新改地址后也会没响应,所以先删除 Disconnect_Quot(); if (_bWantQuotConnect) { timerDisconnect.Enabled = true; Connect_MsgQueue(); } if (_bWantQuotConnect) { Connect_Quot(); } }