コード例 #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
ファイル: Pattern.cs プロジェクト: chtoucas/ChiffonWebSite
        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);
            }
        }