SetEnumEnabled() public méthode

public SetEnumEnabled ( object enumTo, bool enabled ) : void
enumTo object
enabled bool
Résultat void
Exemple #1
0
        private bool GetPriority(out Priority priority)
        {
            Priority[] nonValidOptions =
            {
                Priority.ASM,
                Priority.unknown
            };
            bool result;

            using (EnumChooserForm chooser = new EnumChooserForm())
            {
                chooser.SetEnumType(typeof(Priority));
                chooser.Text        = "Choose an option";
                chooser.Description = "Just choose \"none\" if you don't know what to choose.";
                foreach (Priority item in nonValidOptions)
                {
                    chooser.SetEnumEnabled(item, false);
                }
                result   = chooser.ShowDialog() == DialogResult.OK;
                priority = (Priority)chooser.GetChosenEnum();
            }
            ;
            return(result);
        }
 private bool GetPriority(out Priority priority)
 {
     Priority[] nonValidOptions =
     {
         Priority.ASM,
         Priority.unknown
     };
     bool result;
     using (EnumChooserForm chooser = new EnumChooserForm())
     {
         chooser.SetEnumType(typeof(Priority));
         chooser.Text = "Choose an option";
         chooser.Description = "Just choose \"none\" if you don't know what to choose.";
         foreach (Priority item in nonValidOptions)
         {
             chooser.SetEnumEnabled(item, false);
         }
         result = chooser.ShowDialog() == DialogResult.OK;
         priority = (Priority)chooser.GetChosenEnum();
     }
     ;
     return result;
 }