using System.ComponentModel; using System.Xml.Serialization; namespace OpenTap { /// Child item visibility implements the concept of showing or hiding a child item. This could for example be the child steps of a test step. public static class ChildItemVisibility { /// Child item visibility. public enum Visibility { /// Child items are visible. This is the default state. Visible, /// Child items are collapsed. Collapsed } // when test steps are added to a test plan, // the default should be that the child steps are collapsed. const Visibility DefaultVisibility = Visibility.Collapsed; internal static readonly DynamicMember VisibilityProperty = new DynamicMember { Name = "OpenTap.Visibility", Attributes = new object[] { new BrowsableAttribute(false), new DefaultValueAttribute(DefaultVisibility), new XmlAttributeAttribute() }, DefaultValue = DefaultVisibility, TypeDescriptor = TypeData.FromType(typeof(Visibility)), DeclaringType = TypeData.FromType(typeof(ChildItemVisibility)), Writable = true, Readable = true }; /// Set visibility to collapsed or Visible. /// The object for which to set visibility. /// public static void SetVisibility(object obj, Visibility visibility) { VisibilityProperty.SetValue(obj, visibility); } /// Sets the current collapsed or visible state. If not previously set it will return Visible. /// The object from which to get visibility. public static Visibility GetVisibility(object obj) { return (Visibility) VisibilityProperty.GetValue(obj); } } }