Ejemplo n.º 1
0
        public Client(ITcpClientWrapper client)
        {
            _client             = client;
            _messageHandler     = MapMessageHandlers();
            _userCommandHandler = MapUserCommandHandlers();

            _cancellationTokenSource = new CancellationTokenSource();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates and returns a UserCommandHandler instance with the appropriate
        /// event subscriptions.
        /// </summary>
        /// <returns>A fully subscribed UserCommandHandler instance</returns>
        private UserCommandHandler MapUserCommandHandlers()
        {
            var handler = new UserCommandHandler();

            handler.OnJoinCommand    += JoinCommandSent;
            handler.OnPartCommand    += PartCommandSent;
            handler.OnMessageCommand += PrivateMessageCommandSent;
            handler.OnNickCommand    += NickCommandSent;
            handler.OnHelpCommand    += HelpCommandSent;
            handler.OnQuitCommand    += QuitCommandSent;
            handler.OnUnknownCommand += UnknownCommandSent;
            return(handler);
        }