void _channels_Login(object sender, LoginEventArgs e) { MessageConnection connection = sender as MessageConnection; string strUserName = GetUserName(); string strPassword = GetPassword(); if (string.IsNullOrEmpty(strUserName) == true) { throw new Exception("尚未指定用户名,无法进行登录"); } MessageResult result = connection.LoginAsync( strUserName, strPassword, "", "", "property").Result; if (result.Value == -1) { throw new Exception(result.ErrorInfo); } }