示例#1
0
        public WidgetClient(WidgetCreatorName widgetCreaterName)
        {
            AbstractFactoryAgent objAbstractFactoryAgent = new AbstractFactoryAgent(widgetCreaterName);

            widgetFactoryObj = objAbstractFactoryAgent.GetFactoryObject();
            Window           = widgetFactoryObj.CreateWindow();
            Scrollbar        = widgetFactoryObj.CreateScrollBar();
            Toolbar          = widgetFactoryObj.CreateToolBar();
            Button           = widgetFactoryObj.CreateButtons();
        }
示例#2
0
        public AbstractFactoryAgent(WidgetCreatorName creator)
        {
            switch (creator)
            {
            case WidgetCreatorName.Apple:
                factoryObj = new AppleWidgetFactory();
                break;

            case WidgetCreatorName.Google:
                factoryObj = new GoogleWidgetFactory();
                break;

            case WidgetCreatorName.Microsoft:
                factoryObj = new MicrosoftWidgetFactory();
                break;

            default:
                factoryObj = new AppleWidgetFactory();
                break;
            }
        }