コード例 #1
0
 private BnetChattingRGB getListColor(BnetChattingColor bnetChattingColor = BnetChattingColor.Plain)
 {
     BnetChattingRGB colorSet = new BnetChattingRGB();
     switch (bnetChattingColor)
     {
         case BnetChattingColor.Error:
             colorSet.r = 255;
             colorSet.g = 200;
             colorSet.b = 200;
             break;
         case BnetChattingColor.Info:
             colorSet.r = 230;
             colorSet.g = 242;
             colorSet.b = 255;
             break;
         case BnetChattingColor.Tip:
             colorSet.r = 224;
             colorSet.g = 240;
             colorSet.b = 255;
             break;
         case BnetChattingColor.Whisper:
             colorSet.r = 224;
             colorSet.g = 255;
             colorSet.b = 224;
             break;
         case BnetChattingColor.Me:
             colorSet.r = 255;
             colorSet.g = 240;
             colorSet.b = 224;
             break;
         default:
             colorSet.r = 250;
             colorSet.g = 250;
             colorSet.b = 255;
             break;
     }
     return colorSet;
 }
コード例 #2
0
        private void AddListFriend(BnetUsername name, String clan, BnetChattingColor bnetChattingColor = BnetChattingColor.Plain)
        {
            ListBoxItem lb = new ListBoxItem();
            TextBlock tb = new TextBlock();
            tb.TextWrapping = TextWrapping.Wrap;
            tb.Text = name.name + ((clan != "") ? " [" + clan + "]" : "");
            lb.Content = tb;
            FriendsList.Items.Add(lb);
            FriendsList.SelectedIndex = FriendsList.Items.Count - 1;
            FriendsList.ScrollIntoView(FriendsList.Items[FriendsList.Items.Count - 1]);

            if (name.color != null)
            {
                tb.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#" + name.color));
            }

            BnetChattingRGB colorSet = this.getListColor(bnetChattingColor);
            BnetChattingRGB borderSet = new BnetChattingRGB();

            borderSet.r = (byte)Math.Max(0, colorSet.r - 32);
            borderSet.g = (byte)Math.Max(0, colorSet.g - 32);
            borderSet.b = (byte)Math.Max(0, colorSet.b - 32);
            lb.Background = new SolidColorBrush(Color.FromRgb(colorSet.r, colorSet.g, colorSet.b));
            lb.BorderBrush = new SolidColorBrush(Color.FromRgb(borderSet.r, borderSet.g, borderSet.b));
            lb.BorderThickness = new Thickness(1, 1, 1, 1);
        }
コード例 #3
0
        private void AddListItem(String message, BnetChattingColor bnetChattingColor = BnetChattingColor.Plain)
        {
            ListBoxItem lb = new ListBoxItem();
            DockPanel dp = new DockPanel();
            TextBlock tb = new TextBlock();
            tb.TextWrapping = TextWrapping.Wrap;
            tb.Text = message;
            if (bnetChattingColor == BnetChattingColor.Error || bnetChattingColor == BnetChattingColor.Info || bnetChattingColor == BnetChattingColor.Whisper)
            {
                TextBlock status = new TextBlock();
                Thickness statusMargin = status.Margin;
                statusMargin.Right = 6;
                status.Margin = statusMargin;
                if (bnetChattingColor == BnetChattingColor.Error)
                {
                    status.Text = "[에러]";
                }
                else if (bnetChattingColor == BnetChattingColor.Info)
                {
                    status.Text = "[정보]";
                }
                else if (bnetChattingColor == BnetChattingColor.Whisper)
                {
                    status.Text = "[귓속말]";
                }
                dp.Children.Add(status);
            }
            dp.Children.Add(tb);
            lb.Content = dp;
            MainChatList.Items.Add(lb);
            MainChatList.SelectedIndex = MainChatList.Items.Count - 1;
            MainChatList.ScrollIntoView(MainChatList.Items[MainChatList.Items.Count - 1]);

            BnetChattingRGB colorSet = this.getListColor(bnetChattingColor);
            BnetChattingRGB borderSet = new BnetChattingRGB();

            borderSet.r = (byte)Math.Max(0, colorSet.r - 32);
            borderSet.g = (byte)Math.Max(0, colorSet.g - 32);
            borderSet.b = (byte)Math.Max(0, colorSet.b - 32);
            lb.Background = new SolidColorBrush(Color.FromRgb(colorSet.r, colorSet.g, colorSet.b));
            lb.BorderBrush = new SolidColorBrush(Color.FromRgb(borderSet.r, borderSet.g, borderSet.b));
            lb.BorderThickness = new Thickness(1, 1, 1, 1);
        }