Пример #1
0
        public static PatternImage Create(
            string designerDirectory,
            string categoryDirectory,
            string reference,
            string version,
            PatternImageSize size)
        {
            Require.NotNullOrEmpty(designerDirectory, "directory");
            Require.NotNullOrEmpty(reference, "reference");
            Contract.Ensures(Contract.Result <PatternImage>() != null);

            switch (size)
            {
            case PatternImageSize.Preview:
                return(new Preview_ {
                    CategoryDirectory = categoryDirectory,
                    DesignerDirectory = designerDirectory,
                    Reference = reference,
                    Version = version,
                });

            case PatternImageSize.Original:
                return(new Original_ {
                    CategoryDirectory = categoryDirectory,
                    DesignerDirectory = designerDirectory,
                    Reference = reference,
                    Version = version,
                });

            default:
                throw Acknowledge.Unreachable(
                          "The pattern size '" + size.ToString() + "' is not yet handled.");
            }
        }
Пример #2
0
        public PatternVisibility GetVisibility(PatternImageSize size)
        {
            if (Published)
            {
                switch (size)
                {
                case PatternImageSize.Original:
                    return(PatternVisibility.Members);

                case PatternImageSize.Preview:
                    return((Preferred || Showcased)
                            ? PatternVisibility.Public
                            : PatternVisibility.Members);

                default:
                    throw Acknowledge.Unreachable(
                              "The pattern size '" + size.ToString() + "' is not yet handled.");
                }
            }
            else
            {
                return(PatternVisibility.None);
            }
        }