예제 #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();
        }
예제 #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();
        }