Exemplo n.º 1
0
        public void Disconnect()
        {
            connection?.CloseConnection();

            receiveThread?.Abort();
            var display = new DisplayMessageService();

            display.Display("You were disconnected.", DisplayMessageType.Error);

            var chatStart = new ChatLauncher();

            chatStart.Launch();
        }
Exemplo n.º 2
0
        private void Disconnect(ChatLauncher connection)
        {
            connection.Disconnect();
            var display = new DisplayMessageService();

            display.Display("Disconnected. Try to connect?", DisplayMessageType.System);

            var answer = Console.ReadLine().Trim().ToLower();

            if (answer == "n")
            {
                return;
            }

            LaunchChat();
        }
Exemplo n.º 3
0
        void LaunchChat()
        {
            var connection = new ChatLauncher();

            try
            {
                connection.Launch();
            }
            catch (Exception exception)
            {
                var log = new Logger();
                log.SaveLog(exception);
            }
            finally
            {
                Disconnect(connection);
            }
        }