Пример #1
0
        private void populateRegimens(string Type, TableLayoutPanel TLP, List <RegimenInfo> list)
        {
            // Get a list of all Regimen Attregutes in the PKM
            var RegimenNames = ReflectUtil.getPropertiesStartWithPrefix(pkm.GetType(), Type);

            list.AddRange(from RegimenName in RegimenNames
                          let RegimenValue = ReflectUtil.GetValue(pkm, RegimenName)
                                             where RegimenValue is bool
                                             select new RegimenInfo(RegimenName, (bool)RegimenValue));
            TLP.ColumnCount = 1;
            TLP.RowCount    = 0;

            // Add Regimens
            foreach (var reg in list)
            {
                addRegimenChoice(reg, TLP);
            }

            // Force auto-size
            foreach (RowStyle style in TLP.RowStyles)
            {
                style.SizeType = SizeType.AutoSize;
            }
            foreach (ColumnStyle style in TLP.ColumnStyles)
            {
                style.SizeType = SizeType.AutoSize;
            }
        }
Пример #2
0
        private void populateRibbons()
        {
            // Get a list of all Ribbon Attributes in the PKM
            var RibbonNames = ReflectUtil.getPropertiesStartWithPrefix(pkm.GetType(), "Ribbon");

            foreach (var RibbonName in RibbonNames)
            {
                object RibbonValue = ReflectUtil.GetValue(pkm, RibbonName);
                if (RibbonValue is int)
                {
                    riblist.Add(new RibbonInfo(RibbonName, (int)RibbonValue));
                }
                if (RibbonValue is bool)
                {
                    riblist.Add(new RibbonInfo(RibbonName, (bool)RibbonValue));
                }
            }
            TLP_Ribbons.ColumnCount = 2;
            TLP_Ribbons.RowCount    = 0;

            // Add Ribbons
            foreach (var rib in riblist)
            {
                addRibbonSprite(rib);
                addRibbonChoice(rib);
            }

            // Force auto-size
            foreach (RowStyle style in TLP_Ribbons.RowStyles)
            {
                style.SizeType = SizeType.AutoSize;
            }
            foreach (ColumnStyle style in TLP_Ribbons.ColumnStyles)
            {
                style.SizeType = SizeType.AutoSize;
            }
        }