public void LogIn(LoginUserData data, Reactions reactions = null) { Thread logging = new Thread(() => { if (!this.SendMessage("LOGIN", ("LoginData", data))) { goto disconnection; } reactions?.RequestSentCallback?.Invoke(); Message message = this.ReceiveMessage(); if (message == null) { goto disconnection; } reactions?.MessageReceivedCallback?.Invoke(message); if (message.Title == "SUCCESS") { this.isAuthenticated = true; LadenEventArgs eventArgs = new LadenEventArgs(); eventArgs.PayloadData["message"] = message; this.Authenticated(this, eventArgs); //Thread.Sleep(10000); } return; disconnection: reactions?.DisconnectionErrorCallback?.Invoke(); }); logging.Start(); }
public void SignUp(EditableUserData data, Reactions reactions = null) { Thread signing = new Thread(() => { if (!this.SendMessage("SIGNUP", ("EditableData", data))) { goto disconnection; } reactions?.RequestSentCallback?.Invoke(); Message message = this.ReceiveMessage(); if (message == null) { goto disconnection; } reactions?.MessageReceivedCallback?.Invoke(message); if (message.Title == "SUCCESS") { this.isAuthenticated = true; LadenEventArgs eventArgs = new LadenEventArgs(); eventArgs.PayloadData["message"] = message; this.Authenticated(this, eventArgs); } return; disconnection: reactions?.DisconnectionErrorCallback?.Invoke(); }); signing.Start(); }