Esempio n. 1
0
 public ItemCountCondition(ItemCountCondition src)
     : base(src)
 {
     context = src.context;
     refType = src.refType;
     refId   = src.refId;
     Minimum = src.Minimum;
     Maximum = src.Maximum;
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }