/// <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 StopConnection()
        {
            if (SelectedAccount != null)
            {
                IsConnecting = false;

                await _socketManager.StopConnection(true);

                _socketManager.ConnectionLogUpdated -= UpdateConnectionLog;
            }
        }