internal static void Main(string[] args)
        {
            var documents = new List<Manuscript>();
            var formatter = new FancyFormatter();

            var faq = new FAQ(formatter) { Title = "The Bridge Pattern FAQ" };
            faq.Questions.Add("What is it?", "A design pattern");
            faq.Questions.Add("When do we use it?", "When you need to separate an abstraction from an implementation.");
            documents.Add(faq);

            var book = new Book(formatter)
                           {
                               Title = "Lots of Patterns", 
                               Author = "John Sonmez", 
                               Text = "Blah blah blah..."
                           };
            documents.Add(book);

            var paper = new TermPaper(formatter)
                            {
                                Class = "Design Patterns", 
                                Student = "Joe N00b", 
                                Text = "Blah blah blah...", 
                                References = "GOF"
                            };
            documents.Add(paper);

            foreach (var doc in documents)
            {
                doc.Print();
            }

            // Wait for user
            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            List<Manuscript> documents = new List<Manuscript>();
            IFormatter standard = new FancyFormatter();
            var faq = new Faq(standard);
            documents.Add(faq);

            var book = new Book(standard);
            book.Title = "Book 1";
            documents.Add(book);

            var paper = new TermPaper(standard);
            documents.Add(paper);

            foreach (var doc in documents)
            {
                doc.Print();
            }
        }
示例#3
0
        public static void Main()
        {
            var documents = new List <Manuscript>();
            var formatter = new FancyFormatter(); // new BackwardsFormatter();

            var faq = new Faq(formatter)
            {
                Title = "The Bridge Pattern FAQ"
            };

            faq.Questions.Add("What is it?", "A design pattern");
            faq.Questions.Add("When do we use it?", "When you need to separate an abstraction from an implementation.");
            documents.Add(faq);

            var book = new Book(formatter)
            {
                Title  = "Lots of Patterns",
                Author = "John Sonmez",
                Text   = "Blah blah blah..."
            };

            documents.Add(book);

            var paper = new TermPaper(formatter)
            {
                Class      = "Design Patterns",
                Student    = "Joe N00b",
                Text       = "Blah blah blah...",
                References = "GOF"
            };

            documents.Add(paper);

            foreach (var doc in documents)
            {
                doc.Print();
            }

            // Wait for user
            Console.ReadKey();
        }
示例#4
0
        public static void Main()
        {
            var documents = new List <Manuscript>();
            var formatter = new FancyFormatter(); // new BackwardsFormatter();

            var faq = new Faq(formatter)
            {
                Title = "The Bridge Pattern"
            };

            faq.Questions.Add("What is it?", "A design pattern");
            faq.Questions.Add("When do we use it?", "You have a proliferation of classes resulting from a coupled interface and numerous implementations.");
            documents.Add(faq);

            var book = new Book(formatter)
            {
                Title  = "Game Engine Architecture",
                Author = "Jason Gregory",
                Text   = "Theory and practice of game engine software development."
            };

            documents.Add(book);

            var paper = new TermPaper(formatter)
            {
                Class      = "Level Up!",
                Student    = "Scott Rogers",
                Text       = "Introduction a game design.",
                References = "Theory of fun"
            };

            documents.Add(paper);

            foreach (var doc in documents)
            {
                doc.Print();
            }

            Console.ReadKey();
        }
示例#5
0
        static void Main(string[] args)
        {
            IList <Manuscript> documents = new List <Manuscript>();

            var faq = new FAQ(new RegularFormatter())
            {
                Title = "faqTitle"
            };

            faq.Questions.Add("q1");
            faq.Questions.Add("q2");

            documents.Add(faq);

            var book = new Book(new RegularFormatter())
            {
                Text   = "bookText",
                Title  = "bookTitle",
                Author = "bookAuthor"
            };

            documents.Add(book);

            var paper = new TermPaper(new RegularFormatter())
            {
                Text       = "paperText",
                References = "paperReferences",
                Student    = "pStudent",
                Class      = "pClass"
            };

            documents.Add(paper);

            foreach (var doc in documents)
            {
                doc.Print();
            }

            Console.ReadLine();
        }
示例#6
0
        static void Main(string[] args)
        {
            List <Manuscript> documents = new List <Manuscript>();
            IFormatter        standard  = new FancyFormatter();
            var faq = new Faq(standard);

            documents.Add(faq);

            var book = new Book(standard);

            book.Title = "Book 1";
            documents.Add(book);

            var paper = new TermPaper(standard);

            documents.Add(paper);

            foreach (var doc in documents)
            {
                doc.Print();
            }
        }
示例#7
0
        public static void Main(string[] args)
        {
            var list      = new List <Manuscript>();
            var formatter = new ReverseFormatter();

            var faq = new Faq(formatter)
            {
                Title = "Title"
            };

            faq.Questions.Add("Question one", "Answer to question one");
            faq.Questions.Add("Question two", "Answer to question two");
            list.Add(faq);

            var book = new Book(formatter)
            {
                Title  = "Title",
                Author = "Author",
                Text   = "Text"
            };

            list.Add(book);

            var termPaper = new TermPaper(formatter)
            {
                Class   = "Class",
                Student = "John Oliver",
                Text    = "Text"
            };

            list.Add(termPaper);

            foreach (var l in list)
            {
                l.Print();
            }

            Console.ReadKey();
        }
示例#8
0
        public static void Main(string[] args)
        {
            var standardFormmater = new StandardFormatter();

            var book = new Book(standardFormmater)
            {
                Title  = "Book Title",
                Author = "Book Author",
                Text   = "Book text ..."
            };


            var termPaper = new TermPaper(standardFormmater)
            {
                Class      = "Class Name",
                Student    = "Student Name",
                Text       = "Book text ...",
                References = "Paper References"
            };


            Console.WriteLine("----------------STANDARD FORMMATER----------------------------");
            book.Print();
            termPaper.Print();


            Console.WriteLine("----------------STANDARD FORMMATER----------------------------");
            var reverseFormmater = new ReverseFormatter();

            book.SetFormatter(reverseFormmater);
            book.Print();

            termPaper.SetFormatter(reverseFormmater);
            termPaper.Print();

            Console.ReadKey();
        }