Пример #1
0
        void Send()
        {
            //  Populate a name value collection to fake a MessageEventArg
            NameValueCollection nvc = new NameValueCollection();

            nvc["color"]        = _irc.Color;
            nvc["display-name"] = _irc.DisplayName;
            nvc["mod"]          = _mod ? "1" : "0";
            nvc["subscriber"]   = _subscriber ? "1" : "0";
            nvc["turbo"]        = _irc.Turbo ? "1" : "0";
            nvc["user-type"]    = _irc.UserType == UserType.Mod ? "mod" :
                                  _irc.UserType == UserType.GlobalMod ? "global_mod" :
                                  _irc.UserType == UserType.Admin ? "admin" :
                                  _irc.UserType == UserType.Staff ? "staff" :
                                  "";
            Messages.Add(new ChatMessageViewModel(new MessageEventArgs(nvc, Message)
            {
                User = _irc.User, Channel = ChannelName
            }, _badges));
            if (Messages.Count > App.MAXMESSAGES)
            {
                Messages.RemoveAt(0);
            }

            _irc.Message(_channelName, Message);
            Message = string.Empty;
        }