Exemplo n.º 1
0
        public static object GetItemData(object obj)
        {
            ComboBoxItem cbi = obj as ComboBoxItem;

            if (cbi != null)
            {
                if (cbi.ReadLocalValue(FrameworkElement.TagProperty) != DependencyProperty.UnsetValue)
                {
                    return(cbi.GetValue(FrameworkElement.TagProperty));
                }
                return(cbi.Content);
            }
            return(obj);
        }
Exemplo n.º 2
0
 public static Style GetItemRemoveButtonStyle(ComboBoxItem comboBoxItem)
 {
     return((Style)comboBoxItem.GetValue(ItemRemoveButtonStyleProperty));
 }
Exemplo n.º 3
0
 public static bool GetItemRemovable(ComboBoxItem comboBoxItem)
 {
     return((bool)comboBoxItem.GetValue(ItemRemovableProperty));
 }
 public static bool GetTest(ComboBoxItem target)
 {
     return((bool)target.GetValue(TestAttachedProperty));
 }
Exemplo n.º 5
0
        public void AddFolder(object sender, RoutedEventArgs e)
        {
            //ListBoxItem channelItem = _channelList.SelectedItem as ListBoxItem;
            //string channelID = channelItem.GetValue(idProperty).ToString();

            ViewGuild    serverItem  = _guildComboBox.SelectedItem as ViewGuild;
            ComboBoxItem channelItem = _channelComboBox.SelectedItem as ComboBoxItem;

            string path        = ((Button)sender).CommandParameter.ToString();
            string channelID   = channelItem.GetValue(idProperty).ToString();
            string channelName = channelItem.Content.ToString();

            //chConfig = JsonConvert.DeserializeObject<ChannelConfig>(File.ReadAllText("channels.json"));

            Random r = new Random();
            Color  c = Color.FromRgb((Byte)r.Next(0, 256), (Byte)r.Next(0, 256), (Byte)r.Next(0, 256));


            string color = "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");

            if (!chConfig.list.ContainsKey(channelID))
            {
                chConfig.list.Add(channelID, new ChannelConfig.Values()
                {
                    IconUrl        = serverItem.ImageUrl,
                    GuildName      = serverItem.Name,
                    ChannelName    = channelName,
                    GuildId        = serverItem.Id,
                    ChannelId      = channelID,
                    LastMsgChecked = null,
                    SavePath       = path,
                    ImagesSaved    = 0,
                    Color          = color
                });
            }
            else
            {
                MessageBoxImage mbi  = new MessageBoxImage();
                string          desc = $"This action will overwrite channel's save path, however the program will still download new images from where it left off.\nDo you wish to continue?";

                // should be custom messagebox... but meh
                MessageBoxResult result = MessageBox.Show(desc, "This channel already has a folder set-up", MessageBoxButton.YesNo, mbi, MessageBoxResult.Yes);

                if (result == MessageBoxResult.No)
                {
                    return;
                }

                config.ChConfig = chConfig;

                chConfig.list[channelID] = new ChannelConfig.Values()
                {
                    IconUrl        = serverItem.ImageUrl,
                    GuildName      = serverItem.Name,
                    ChannelName    = channelName,
                    GuildId        = serverItem.Id,
                    ChannelId      = channelID,
                    LastMsgChecked = chConfig.list[channelID].LastMsgChecked,
                    SavePath       = path,
                    ImagesSaved    = chConfig.list[channelID].ImagesSaved,
                    Color          = color
                };
            }

            config.ChConfig = chConfig;

            UpdateFolderGrid(true);
            RefreshDropboxList();
            myTray.UpdateTrayFolders();

            string json = JsonConvert.SerializeObject(config, Formatting.Indented);

            byte[] fileContent = Encoding.UTF8.GetBytes(json);

            Atomic.OverwriteFile("config.json", new MemoryStream(fileContent), "config.json.backup");
        }
Exemplo n.º 6
0
 public static ICommand GetRemoveCommand(ComboBoxItem comboBoxItem)
 {
     return((ICommand)comboBoxItem.GetValue(RemoveCommandProperty));
 }
 public static Brush GetSelectedBackground(ComboBoxItem comboBoxItem)
 {
     return((Brush)comboBoxItem.GetValue(SelectedBackgroundProperty));
 }
Exemplo n.º 8
0
 public static Brush GetItemSelectedBorderBrush(ComboBoxItem comboBoxItem)
 {
     return((Brush)comboBoxItem.GetValue(ItemSelectedBorderBrushProperty));
 }
 public static AuxiliaryButtonVisibility GetRemoveButtonVisibility(ComboBoxItem comboBoxItem)
 {
     return((AuxiliaryButtonVisibility)comboBoxItem.GetValue(RemoveButtonVisibilityProperty));
 }
 public static CornerRadius GetCornerRadius(ComboBoxItem comboBoxItem)
 {
     return((CornerRadius)comboBoxItem.GetValue(CornerRadiusProperty));
 }
 public static Visibility GetSeparatorVisibility(ComboBoxItem comboBoxItem)
 {
     return((Visibility)comboBoxItem.GetValue(SeparatorVisibilityProperty));
 }
 public static Thickness GetSeparatorMargin(ComboBoxItem comboBoxItem)
 {
     return((Thickness)comboBoxItem.GetValue(SeparatorMarginProperty));
 }
 public static double GetSeparatorThickness(ComboBoxItem comboBoxItem)
 {
     return((double)comboBoxItem.GetValue(SeparatorThicknessProperty));
 }
 public static Brush GetSeparatorBrush(ComboBoxItem comboBoxItem)
 {
     return((Brush)comboBoxItem.GetValue(SeparatorBrushProperty));
 }
 public static Thickness?GetSelectedBorderThickness(ComboBoxItem comboBoxItem)
 {
     return((Thickness?)comboBoxItem.GetValue(SelectedBorderThicknessProperty));
 }
Exemplo n.º 16
0
 public static Brush GetItemHoverBackground(ComboBoxItem comboBoxItem)
 {
     return((Brush)comboBoxItem.GetValue(ItemHoverBackgroundProperty));
 }
Exemplo n.º 17
0
 public static Brush GetItemSelectedForeground(ComboBoxItem comboBoxItem)
 {
     return((Brush)comboBoxItem.GetValue(ItemSelectedForegroundProperty));
 }
 public static Brush GetHoverForeground(ComboBoxItem comboBoxItem)
 {
     return((Brush)comboBoxItem.GetValue(HoverForegroundProperty));
 }
 public static Brush GetHoverBorderBrush(ComboBoxItem comboBoxItem)
 {
     return((Brush)comboBoxItem.GetValue(HoverBorderBrushProperty));
 }
 public static object GetIcon(ComboBoxItem comboBoxItem)
 {
     return((object)comboBoxItem.GetValue(IconProperty));
 }