public OptionSelectedCondition(OptionSelectedCondition src)
     : base(src)
 {
     source   = src.source;
     Require  = src.Require;
     Prohibit = src.Prohibit;
 }
        public static Condition Load(JsonReader reader)
        {
            //	We depend on the LayoutType property being first so that we can
            //	know what type to create
            string propName = (string)reader.Value;

            if (propName != "ConditionType")
            {
                throw new DesignException($"Expected ConditionType property, got '{propName}'.");
            }

            Condition condition = null;
            string    typename  = JsonHelper.ReadString(reader);

            switch (typename)
            {
            case "EmptyLayoutCondition":
                condition = new EmptyLayoutCondition(reader);
                break;

            case "OptionSelectedCondition":
                condition = new OptionSelectedCondition(reader);
                break;

            case "ContentSelectedCondition":
                condition = new ContentSelectedCondition(reader);
                break;

            case "DocTagCondition":
                condition = new DocTagCondition(reader);
                break;

            case "ContentDocTagCondition":
                condition = new ContentDocTagCondition(reader);
                break;

            case "ItemCountCondition":
                condition = new ItemCountCondition(reader);
                break;

            case "PhotoCountCondition":
                condition = new PhotoCountCondition(reader);
                break;

            default:
                throw new DesignException($"Unrecognized condition type '{typename}'.");
            }
            return(condition);
        }
        public static Condition Load(XElement element)
        {
            Condition condition = null;

            switch (element.Name.LocalName)
            {
            case "EmptyLayoutCondition":
                condition = new EmptyLayoutCondition(element);
                break;

            case "OptionSelectedCondition":
                condition = new OptionSelectedCondition(element);
                break;

            case "ContentSelectedCondition":
                condition = new ContentSelectedCondition(element);
                break;

            case "DocTagCondition":
                condition = new DocTagCondition(element);
                break;

            case "ContentDocTagCondition":
                condition = new ContentDocTagCondition(element);
                break;

            case "ItemCountCondition":
                condition = new ItemCountCondition(element);
                break;

            case "PhotoCountCondition":
                condition = new PhotoCountCondition(element);
                break;

            default:
                throw new DesignException($"Unrecognized condition type '{element.Name.LocalName}'.", element);
            }
            return(condition);
        }