Esempio n. 1
0
        private void ApplyIcons()
        {
            RelhaxComboBoxItem relhaxComboBoxItem = (RelhaxComboBoxItem)this.SelectedItem;
            SelectablePackage  package            = relhaxComboBoxItem.Package;

            while (thePanel.Children.Count > 1)
            {
                thePanel.Children.RemoveAt(thePanel.Children.Count - 1);
            }

            if (package.ObfuscatedMod)
            {
                Image img = new Image()
                {
                    VerticalAlignment = VerticalAlignment.Top,
                    Width             = 16,
                    Height            = 16,
                    Source            = new BitmapImage(new Uri(@"/RelhaxModpack;component/Resources/Images/obfuscated_package_icon.png", UriKind.Relative))
                };
                thePanel.Children.Add(img);
            }
            if (package.GreyAreaMod)
            {
                Image img = new Image()
                {
                    VerticalAlignment = VerticalAlignment.Top,
                    Width             = 16,
                    Height            = 16,
                    Source            = new BitmapImage(new Uri(@"/RelhaxModpack;component/Resources/Images/grey_area_mod.png", UriKind.Relative))
                };
                thePanel.Children.Add(img);
            }
            if (package.PopularMod)
            {
                Image img = new Image()
                {
                    VerticalAlignment = VerticalAlignment.Top,
                    Width             = 16,
                    Height            = 16,
                    Source            = new BitmapImage(new Uri(@"/RelhaxModpack;component/Resources/Images/popular_icon.png", UriKind.Relative))
                };
                thePanel.Children.Add(img);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Called from the database object to update the UI on a combobox selection change
 /// </summary>
 /// <param name="spc">The SelectablePakage that caused the update</param>
 /// <param name="value">The checked value</param>
 public void OnDropDownSelectionChanged(SelectablePackage spc, bool value)
 {
     for (int i = 0; i < Items.Count; i++)
     {
         RelhaxComboBoxItem cbi = (RelhaxComboBoxItem)Items[i];
         if (cbi.Package.Equals(spc) && value && cbi.Package.Enabled)
         {
             //change it
             SelectedItem = cbi;
             //continue as to not uncheck this value, now that it's checked
             continue;
         }
         //if value is false it will uncheck all the packages
         if (cbi.Package.Enabled && cbi.Package.Checked)
         {
             cbi.Package.Checked = false;
         }
     }
     if (!value)
     {
         SelectedIndex = 0;
     }
 }