示例#1
0
        static public void Main(string[] args)
        {
            MessageMediator chat = new Chat();

            User user1 = new ChatUser(chat, "Gosho");
            User user2 = new ChatUser(chat, "Stoyan");
            User user3 = new ChatUser(chat, "Kiro");

            user1.Send("nigg");
            user2.Send("ei");
            user1.Send("addBot");
            user3.Send("cat");
            user2.Send("marto");
        }
示例#2
0
        public void UpdateColor(int color, ChatUser sender)
        {
            //Check change condition
            if (true)
            {
                this.Color = color;
                store.Save(this);

                ChangeBubbleChatColor packet = new ChangeBubbleChatColor()
                {
                    ConversationID = this.ID.ToString(),
                    Color          = color
                };

                foreach (Guid memberID in Members)
                {
                    if (!ChatUserManager.IsOnline(memberID))
                    {
                        continue;
                    }
                    ChatUser user = ChatUserManager.LoadUser(memberID);
                    user.Send(packet);
                }
            }
            else
            {
                ChangeBubbleChatColor packet = new ChangeBubbleChatColor()
                {
                    ConversationID = this.ID.ToString(),
                    Color          = this.Color
                };
                sender.Send(packet);
            }
        }
示例#3
0
        public void Handle(ISession session)
        {
            ChatSession chatSession = session as ChatSession;
            ChatUser    user        = chatSession.Owner;

            user.ChatThemeSettings.BackgroundId   = Theme.BackgroundId;
            user.ChatThemeSettings.BackgroundBlur = Theme.BackgroundBlur;

            user.ChatThemeSettings.BackgroundColor = Theme.BackgroundColor;

            user.ChatThemeSettings.Use = Theme.Use;

            user.ChatThemeSettings.IconColor = Theme.IconColor;

            user.SaveChatTheme();

            user.Send(this, chatSession);
        }