Exemplo n.º 1
0
 public ParameterTogglePanel(CompileParameter cp)
 {
     AutoSize  = true;
     RowCount  = 1;
     GrowStyle = TableLayoutPanelGrowStyle.AddColumns;
     Margin    = new Padding(0, 0, 10, 0);
     Parameter = cp;
     CheckBox  = new CheckBox
     {
         Text    = cp.Name,
         Checked = cp.Enabled,
         Width   = 135,
         Height  = 17,
         Margin  = new Padding(3, 3, 0, 3)
     };
     CheckBox.CheckedChanged += (s, e) => OnValueChanged();
     Controls.Add(CheckBox);
     AddControls();
 }
Exemplo n.º 2
0
        public static CompileParameter Parse(GenericStructure gs)
        {
            var param = new CompileParameter
            {
                Name         = gs["Name"] ?? "",
                Flag         = gs["Flag"] ?? "",
                Description  = gs["Description"] ?? "",
                Enabled      = gs.PropertyBoolean("Enabled"),
                Value        = gs["Value"] ?? "",
                Type         = gs.PropertyEnum("Type", CompileParameterType.Checkbox),
                Min          = gs.PropertyDecimal("Min", Decimal.MinValue),
                Max          = gs.PropertyDecimal("Max", Decimal.MaxValue),
                Precision    = gs.PropertyInteger("Precision", 1),
                Options      = (gs["Options"] ?? "").Split(',').ToList(),
                OptionValues = (gs["OptionValues"] ?? "").Split(',').ToList(),
                Filter       = gs["Filter"] ?? ""
            };

            return(param);
        }