async private void Init() { this.tbx_pwd.PasswordChar = '*'; mesService = new MesService.MesServiceClient(); if (!TestCommunication()) { return; } //设置单行 //tbx_username.Multiline = false; tbx_pwd.Multiline = false; DataSet ds = await mesService.GetAllUserInfoAsync(); if (ds == null) { MessageBox.Show("连接数据库服务异常!", "ERR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var dt = ds.Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //tbx_username.Items.Add(dt.Rows[i][0].ToString()); } } else { //添加默认用户 mesService.Register("superAdminMES", "superAdminMES", 0); } tbx_username.Text = ""; configPath = AppDomain.CurrentDomain.BaseDirectory + INI_CONFIG_NAME; ReadLastCfg(); }