Ejemplo n.º 1
0
        internal void Launch()
        {
            try
            {
                connection = new ServerConnection();
            }catch (Exception exception)
            {
                var logger = new Logger();
                logger.SaveLog(exception);
                var displayService = new DisplayMessageService();
                displayService.Display(exception.Message, DisplayMessageType.Error);
            }
            if (connection == null)
            {
                Disconnect();
            }
            chatCore = new ChatCore(this, connection.stream);
            var displayMessage = new DisplayMessageService();

            displayMessage.Display("Connected.", DisplayMessageType.Success);
            var receiver = new Receiver(connection.stream, this, chatCore);

            receiveThread = new Thread(() => receiver.ReceiveMessage());
            receiveThread.Start();

            var commandHandler = new InputHandler(connection.stream, this, chatCore);

            commandHandler.ConsoleReading();

            receiveThread.Join();
        }
Ejemplo n.º 2
0
 internal Receiver(NetworkStream networkStream, IDisconnectable disconnector, ChatCore chatCore)
 {
     this.disconnector = disconnector;
     stream            = networkStream;
     this.chatCore     = chatCore;
 }
Ejemplo n.º 3
0
 internal InputHandler(NetworkStream networkStream, IDisconnectable disconnector, ChatCore chatCore)
 {
     stream            = networkStream;
     this.disconnector = disconnector;
     this.chatCore     = chatCore;
 }