Exemplo n.º 1
0
 public static void SetItemHoverBackground(ComboBoxItem comboBoxItem, Brush value)
 {
     comboBoxItem.SetValue(ItemHoverBackgroundProperty, value);
 }
Exemplo n.º 2
0
 public static void SetItemRemovable(ComboBoxItem comboBoxItem, bool value)
 {
     comboBoxItem.SetValue(ItemRemovableProperty, value);
 }
Exemplo n.º 3
0
 public static void SetItemRemoveButtonStyle(ComboBoxItem comboBoxItem, Style value)
 {
     comboBoxItem.SetValue(ItemRemoveButtonStyleProperty, value);
 }
Exemplo n.º 4
0
        private async void OnServerSelected(object sender, RoutedEventArgs e)
        {
            if (!(_guildComboBox.SelectedItem is ViewGuild vg))
            {
                return;
            }

            this._addFolder.IsEnabled = false;

            IReadOnlyList <Channel> channels;

            try
            {
                string guildID = ((ViewGuild)_guildComboBox.SelectedItem).Id;

                DiscordAPI d = new DiscordAPI();
                channels = await d.GetGuildChannelsAsync(config.Token, guildID); // this._token.Text
            }
            catch
            {
                MessageBox.Show("Something went wrong (token?)");
                return;
            }

            ComboBox combobox = this._channelComboBox;

            combobox.Items.Clear();

            // order by .ParentId, aka by category
            List <Channel> channelList = channels.ToList().OrderBy(x => x.ParentId).ToList();

            foreach (var ch in channelList)
            {
                if (ch.Type != ChannelType.GuildTextChat)
                {
                    // skip, we list only text channels
                    continue;
                }

                ComboBoxItem         item = new ComboBoxItem();
                ChannelConfig.Values _chCnf;

                chConfig.list.TryGetValue(ch.Id, out _chCnf);

                if (_chCnf.ChannelId == ch.Id)
                {
                    Color color = (Color)ColorConverter.ConvertFromString(_chCnf.Color);
                    item.BorderBrush = new SolidColorBrush(color);
                    item.Foreground  = new SolidColorBrush(color);

                    //item.Background = new SolidColorBrush(color);
                    //item.IsEnabled = false;
                }

                item.BorderThickness = new Thickness(5, 0, 0, 0);

                string prefix = ch.ParentId != null?channelList.Find(x => x.Id == ch.ParentId).Name + " > " : "";

                item.Content   = $"{prefix}{ch.Name}";
                item.Selected += OnChannelSelected;
                item.SetValue(idProperty, ch.Id);

                combobox.Items.Add(item);
            }
        }
 public static void SetTest(ComboBoxItem target, bool value)
 {
     target.SetValue(TestAttachedProperty, value);
 }
 public static void SetIcon(ComboBoxItem comboBoxItem, object value)
 {
     comboBoxItem.SetValue(IconProperty, value);
 }
 public static void SetHoverBorderBrush(ComboBoxItem comboBoxItem, Brush value)
 {
     comboBoxItem.SetValue(HoverBorderBrushProperty, value);
 }
 public static void SetCornerRadius(ComboBoxItem comboBoxItem, CornerRadius value)
 {
     comboBoxItem.SetValue(CornerRadiusProperty, value);
 }
 public static void SetRemoveButtonVisibility(ComboBoxItem comboBoxItem, AuxiliaryButtonVisibility value)
 {
     comboBoxItem.SetValue(RemoveButtonVisibilityProperty, value);
 }
 public static void SetSeparatorMargin(ComboBoxItem comboBoxItem, Thickness value)
 {
     comboBoxItem.SetValue(SeparatorMarginProperty, value);
 }
 public static void SetSeparatorVisibility(ComboBoxItem comboBoxItem, Visibility value)
 {
     comboBoxItem.SetValue(SeparatorVisibilityProperty, value);
 }
 public static void SetSeparatorThickness(ComboBoxItem comboBoxItem, double value)
 {
     comboBoxItem.SetValue(SeparatorThicknessProperty, value);
 }
 public static void SetSeparatorBrush(ComboBoxItem comboBoxItem, Brush value)
 {
     comboBoxItem.SetValue(SeparatorBrushProperty, value);
 }
 public static void SetSelectedBorderThickness(ComboBoxItem comboBoxItem, Thickness?value)
 {
     comboBoxItem.SetValue(SelectedBorderThicknessProperty, value);
 }
Exemplo n.º 15
0
 public static void SetItemSelectedForeground(ComboBoxItem comboBoxItem, Brush value)
 {
     comboBoxItem.SetValue(ItemSelectedForegroundProperty, value);
 }
 public static void SetHoverForeground(ComboBoxItem comboBoxItem, Brush value)
 {
     comboBoxItem.SetValue(HoverForegroundProperty, value);
 }
Exemplo n.º 17
0
 public static void SetItemSelectedBorderBrush(ComboBoxItem comboBoxItem, Brush value)
 {
     comboBoxItem.SetValue(ItemSelectedBorderBrushProperty, value);
 }
 public static void SetSelectedBackground(ComboBoxItem comboBoxItem, Brush value)
 {
     comboBoxItem.SetValue(SelectedBackgroundProperty, value);
 }