/// <summary> /// Will attempt to login with the account provided, if in test-mode then the connection will be closed immediately after. /// </summary> /// <param name="account">The account with which to login</param> /// <param name="testMode">Will close the connection immediately after if true</param> /// <returns>The connection result</returns> public async Task <ConnectResult> LoginWithAccount(Account account, bool testMode = false) { // Make sure to reset the connection and deleting it. await _socketManager.StopConnection(true); ConnectResult result = await _socketManager.StartConnection(account.ToConnectData()); if (!result.IsConnected) { return(result); } result = await SendAccountAuthentication(account.ToConnectData()); await SendSystemIdentify(); result.IsConnected = await SendCharacterSelect(account.DefaultCharacter); if (testMode) { await _socketManager.StopConnection(true); } else { DataEvents.InvokeConnectionStatus(true); } return(result); }
private async void StartConnection() { if (SelectedAccount != null) { IsConnecting = true; _socketManager.ConnectionLogUpdated += UpdateConnectionLog; var connectData = SelectedAccount.ToConnectData(); await _socketManager.StartConnection(connectData); } }