Beispiel #1
0
        bool EnterPressed()
        {
            if (!inputBox.Text.Any())
            {
                return(true);
            }

            var text = inputBox.Text;

            inputBox.Text = "";

            if (text[0] == '/')
            {
                var parts = text.Split(new[] { ' ' }, 2);
                var name  = parts[0].Substring(1);
                var args  = parts.Length > 1 ? parts[1] : null;

                Action <string> command;
                if (!commands.TryGetValue(name, out command))
                {
                    IrcClient.AddHistory("{0}: Unknown command".F(name));
                    return(true);
                }
                command(args);
            }
            else
            {
                IrcClient.Instance.Message(IrcClient.MainChannel, text);
                IrcClient.AddMessage(IrcClient.Instance.LocalUser.Nickname, text);
            }
            return(true);
        }