public WidgetClient(WidgetCreatorName widgetCreaterName) { AbstractFactoryAgent objAbstractFactoryAgent = new AbstractFactoryAgent(widgetCreaterName); widgetFactoryObj = objAbstractFactoryAgent.GetFactoryObject(); Window = widgetFactoryObj.CreateWindow(); Scrollbar = widgetFactoryObj.CreateScrollBar(); Toolbar = widgetFactoryObj.CreateToolBar(); Button = widgetFactoryObj.CreateButtons(); }
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; } }