Ejemplo n.º 1
0
        public static void FirstDemo()
        {
            var standartFormatter = new StandartFormatter();
            var reverseFormatter  = new ReverseFormatter();
            var crazyFormatter    = new CrazyFormater();
            var book = new Book(standartFormatter)
            {
                Author = "Shawn O Briang", Text = "Cool book about how i lost my life", Title = "7 Circles Of Hell"
            };
            var termPaper = new TermPaper(reverseFormatter)
            {
                Class = "Designs Patterns", Student = "Vladimir Voev", Text = "Bridge Pattern", Reference = "WWW=)"
            };
            var faq = new Faq(crazyFormatter)
            {
                Title = "Bridge Pattern ??"
            };

            faq.Questions.Add("What is this", "A Dessign Pattern");
            faq.Questions.Add("When is good to be used", "When you need to separate an abstraction from an implementation");

            var printer = new List <Printer>();

            printer.Add(book);
            printer.Add(termPaper);
            printer.Add(faq);
            GenerateReport(printer);
        }
Ejemplo n.º 2
0
        private void BridgeReal()
        {
            List <Manuscript> manuscripts       = new List <Manuscript>();
            StandartFormatter standartFormatter = new StandartFormatter();
            ReverseForrmatter reverseForrmatter = new ReverseForrmatter();

            var faq = new FAQ(standartFormatter)
            {
                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 abastraction from an implementation.");
            manuscripts.Add(faq);

            var book = new Book(reverseForrmatter)
            {
                Title  = "1Q84",
                Author = "Haruki Murakami",
                Text   = "The story begins in gridlock on a Tokyo superhighway bridge."
            };

            manuscripts.Add(book);

            foreach (var item in manuscripts)
            {
                item.Print();
            }
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            var standartFormatter  = new StandartFormatter();
            var backwardsFormatter = new BackWardsFormatter();

            var documents = new List <MenuScript>();

            var book  = new Book(standartFormatter);
            var paper = new Paper(backwardsFormatter);

            documents.Add(book);
            documents.Add(paper);

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