public void Register(RegisterData registerData, Action <string> onRegister) { Connect((error) => { if (error == null) { try { var netSender = new NetDataSender( new RequestInfo("RegisterStudent", SequrityUtils.Encrypt(registerData.ToJson(), _User.SecretKey), _User.UserToken), (responseData) => { var responseInfo = ResponseInfo.FromJson(responseData); if (responseInfo.Error != null) { Disconnect(); onRegister(responseInfo.Error); } else { if (SequrityUtils.DecryptString(responseInfo.Data, _User.SecretKey) == "OK") { Disconnect(); onRegister(null); } else { Disconnect(); onRegister(responseInfo.Error); } } }, Address); } catch (Exception e) { onRegister("Ошибка авторизации: " + e.Message); } } else { onRegister(error); } }); }