示例#1
0
        private void PopulateRegimens(string Type, TableLayoutPanel TLP, List <RegimenInfo> list)
        {
            // Get a list of all Regimen Attregutes in the PKM
            var RegimenNames = ReflectFrameworkUtil.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;
            }
        }
        private void PopulateRibbons()
        {
            // Get a list of all Ribbon Attributes in the PKM
            var RibbonNames = ReflectFrameworkUtil.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);
            }
            foreach (var rib in riblist.OrderBy(z => RibbonStrings.GetName(z.Name)))
            {
                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;
            }
        }