private static async void MainThread() { console = new AsyncConsole(200, 300); console.InputForegroundColor = ConsoleColor.White; console.OutputBackgroundColor = ConsoleColor.Black; console.OutputForegroundColor = ConsoleColor.White; console.InputBackgroundColor = ConsoleColor.Black; console.WindowWidth = 200; console.Clear(); var client = new BattleNetClient(_settings); client.Connected += Client_Connected; client.Disconnected += Client_Disconnected; client.ClientCheckPassed += client_ClientCheckPassed; client.ClientCheckFailed += client_ClientCheckFailed; client.LoginSucceeded += client_LoginSucceeded; client.LoginFailed += client_LoginFailed; client.AccountCreated += client_AccountCreated; client.AccountCreationFailed += client_AccountCreationFailed; client.Channel.UserJoined += Client_UserJoinedChannel; client.Channel.UserLeft += Client_UserLeftChannel; client.Channel.UserShown += Client_UserWasInChannel; client.Channel.UserSpoke += Client_UserSpoke; client.Channel.UserEmoted += Client_UserEmoted; client.Channel.NewChannelJoined += Channel_NewChannelJoined; client.ServerError += client_ServerError; client.ServerInformation += client_ServerInformation; client.Broadcast += client_Broadcast; client.WhisperReceived += client_WhisperReceived; client.WhisperSent += client_WhisperSent; client.ChannelListReceived += client_ChannelListReceived; client.ConnectAsync(); string lastInput; do { lastInput = await console.ReadLineAsync(); switch (lastInput) { case "/clear": console.Clear(); break; case "/channel-list": case "/cl": if (_channel != null) { client_ChannelListReceived(client, _channel); } else { console.OutputForegroundColor = ConsoleColor.Red; console.WriteLine("The channel list has not yet been received."); } break; case "/quit": client.Disconnect(); break; default: client.Send(lastInput); break; } } while (lastInput != "/quit"); _ended.Set(); }