示例#1
0
        public ChatRoom(LocalUser admin)
        {
            Admin = admin;

            Users = new List<IUser>();
            Users.Add(Admin);

            StandardCommands = new Dictionary<string, Command>();
            ModCommands = new Dictionary<string, Command>();

            StandardCommands.Add("help", Help);
            StandardCommands.Add("name", Nick);
            StandardCommands.Add("nick", Nick);
            StandardCommands.Add("who", Who);
            StandardCommands.Add("w", Whisper);
            StandardCommands.Add("pm", Whisper);
            StandardCommands.Add("me", Me);

            ModCommands.Add("kick", Kick);
            ModCommands.Add("ban", Kick);
            ModCommands.Add("mute", Mute);
            ModCommands.Add("rename", Rename);
            ModCommands.Add("mod", Mod);
            ModCommands.Add("op", Mod);
            ModCommands.Add("demod", Demod);
            ModCommands.Add("deop", Demod);
            ModCommands.Add("connect", Connect);
        }
        public MainWindow()
        {
            InitializeComponent();

            Admin = new LocalUser();
            ChatRoom = new ChatRoom(Admin);
            ChatRoom.CommandEngineEnabled = true;
            ChatRoom.NewMessage += ChatRoom_NewMessage;
            ChatRoom.StatusChanged += ChatRoom_StatusChanged;

            UserBox.ItemsSource = ChatRoom.Users;

            ReceiveBox.Document.Blocks.Clear();

            SendBox.KeyDown += SendBox_KeyDown;
            AutoReconnectCheck.Checked += AutoReconnectCheck_Checked;
            AddUserBtn.Click += AddUserBtn_Click;
            KickContext.Click += KickCtx_Click;
            MuteContext.Click += MuteCtx_Click;
        }