Esempio n. 1
0
        static void Main(string[] args)
        {
            WidgetFactory widgetFactory = new PMWidgetFactory();

            widgetFactory.CreateScrollBar().showBar();
            widgetFactory.CreateWindow().showWindow();

            widgetFactory = new MotifFactory();
            widgetFactory.CreateScrollBar().showBar();
            widgetFactory.CreateWindow().showWindow();
        }
Esempio n. 2
0
        public static void ExecuteScript()
        {
            Console.WriteLine(new string('_', 100));
            Console.WriteLine("ABSTRACT FACTORY\n\n");

            IWidgetFactory widgetFactory;

            widgetFactory = new MotifWidgetFactory();
            Console.WriteLine("\tMotif Widget:");

            widgetFactory.CreateScrollBar().ScrollTo(30);
            widgetFactory.CreateWindow().Draw();

            Console.WriteLine("\n\n");

            widgetFactory = new PMWidgetFactory();
            Console.WriteLine("\tPresentation Manager Widget:");

            widgetFactory.CreateScrollBar().ScrollTo(30);
            widgetFactory.CreateWindow().Draw();
        }