示例#1
0
 void m_ban_Clicked(TimeOutIcon icon)
 {
     if (m_user != null)
     {
         if (Controller.Ban(m_user))
         {
             m_ban.ShowAlternate();
         }
     }
 }
示例#2
0
 void m_eight_Clicked(TimeOutIcon obj)
 {
     if (m_user != null)
     {
         if (Controller.Timeout(m_user, 28800))
         {
             m_eight.ShowAlternate();
         }
     }
 }
示例#3
0
 void Unban(TimeOutIcon icon)
 {
     Controller.Unban(m_user);
     icon.ShowIcon();
 }
示例#4
0
        private void SetMessage(ChatMessage msg)
        {
            m_user = msg.User;

            m_ban = new TimeOutIcon(GetImage(s_ban), GetImage(s_check));
            m_ban.BaselineAlignment = BaselineAlignment.Center;
            m_ban.Clicked += m_ban_Clicked;
            m_ban.Restore += Unban;

            m_eight = new TimeOutIcon(GetImage(s_eight), GetImage(s_check));
            m_eight.BaselineAlignment = BaselineAlignment.Center;
            m_eight.Clicked += m_eight_Clicked;
            m_eight.Restore += Unban;

            m_timeout = new TimeOutIcon(GetImage(s_timeout), GetImage(s_check));
            m_timeout.Clicked += m_timeout_Clicked;
            m_timeout.BaselineAlignment = BaselineAlignment.Center;
            m_timeout.Restore += Unban;

            if (Controller.ShowTimestamps)
                Inlines.Add(new Run(DateTime.Now.ToString("hh:mm ")) { Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070")), BaselineAlignment = BaselineAlignment.Center });

            if (Controller.ShowIcons && Controller.CurrentUser.IsModerator)
            {
                Inlines.Add(m_ban);
                Inlines.Add(m_eight);
                Inlines.Add(m_timeout);
            }

            if (m_user.IsModerator)
            {
                m_mod = new InlineUIContainer(GetImage(s_mod));
                m_mod.BaselineAlignment = BaselineAlignment.Center;
                Inlines.Add(m_mod);
            }

            var user = msg.User;
            if (user.IsSubscriber)
            {
                var sub = new InlineUIContainer(GetImage(s_sub));
                sub.BaselineAlignment = BaselineAlignment.Center;
                Inlines.Add(sub);
            }

            Brush userColor = Brushes.Black;
            if (user.Color != null)
            {
                try
                {
                    userColor = (SolidColorBrush)(new BrushConverter().ConvertFrom(msg.User.Color));
                }
                catch (NotSupportedException)
                {
                }
            }

            m_name = new Run(user.Name) { FontWeight = FontWeights.Bold, Foreground = userColor, BaselineAlignment = BaselineAlignment.Center };
            Inlines.Add(m_name);

            if (msg.Type != ItemType.Action)
                Inlines.Add(new Run(": ") { BaselineAlignment = BaselineAlignment.Center });

            BuildText(msg);
        }
示例#5
0
 void m_timeout_Clicked(TimeOutIcon obj)
 {
     if (m_user != null)
         if (Controller.Timeout(m_user, 600))
             m_timeout.ShowAlternate();
 }
示例#6
0
 void m_ban_Clicked(TimeOutIcon icon)
 {
     if (m_user != null)
         if (Controller.Ban(m_user))
             m_ban.ShowAlternate();
 }
示例#7
0
 void Unban(TimeOutIcon icon)
 {
     Controller.Unban(m_user);
     icon.ShowIcon();
 }
示例#8
0
        private void SetMessage(ChatMessage msg)
        {
            m_user = msg.User;

            m_ban = new TimeOutIcon(GetImage(s_ban), GetImage(s_check));
            m_ban.BaselineAlignment = BaselineAlignment.Center;
            m_ban.Clicked          += m_ban_Clicked;
            m_ban.Restore          += Unban;

            m_eight = new TimeOutIcon(GetImage(s_eight), GetImage(s_check));
            m_eight.BaselineAlignment = BaselineAlignment.Center;
            m_eight.Clicked          += m_eight_Clicked;
            m_eight.Restore          += Unban;

            m_timeout                   = new TimeOutIcon(GetImage(s_timeout), GetImage(s_check));
            m_timeout.Clicked          += m_timeout_Clicked;
            m_timeout.BaselineAlignment = BaselineAlignment.Center;
            m_timeout.Restore          += Unban;

            if (Controller.ShowTimestamps)
            {
                Inlines.Add(new Run(DateTime.Now.ToString("hh:mm "))
                {
                    Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070")), BaselineAlignment = BaselineAlignment.Center
                });
            }

            if (Controller.ShowIcons && Controller.CurrentUser.IsModerator)
            {
                Inlines.Add(m_ban);
                Inlines.Add(m_eight);
                Inlines.Add(m_timeout);
            }

            if (m_user.IsModerator)
            {
                m_mod = new InlineUIContainer(GetImage(s_mod));
                m_mod.BaselineAlignment = BaselineAlignment.Center;
                Inlines.Add(m_mod);
            }

            var user = msg.User;

            if (user.IsSubscriber)
            {
                var sub = new InlineUIContainer(GetImage(s_sub));
                sub.BaselineAlignment = BaselineAlignment.Center;
                Inlines.Add(sub);
            }

            Brush userColor = Brushes.Black;

            if (user.Color != null)
            {
                try
                {
                    userColor = (SolidColorBrush)(new BrushConverter().ConvertFrom(msg.User.Color));
                }
                catch (NotSupportedException)
                {
                }
            }

            m_name = new Run(user.Name)
            {
                FontWeight = FontWeights.Bold, Foreground = userColor, BaselineAlignment = BaselineAlignment.Center
            };
            Inlines.Add(m_name);

            if (msg.Type != ItemType.Action)
            {
                Inlines.Add(new Run(": ")
                {
                    BaselineAlignment = BaselineAlignment.Center
                });
            }

            BuildText(msg);
        }