示例#1
0
        public void Build()
        {
            IPartFactory partFactory = null;

            switch (wantedManufacturer)
            {
            case Manufacturer.Fujitsu:
                partFactory = new FujitsuPartFactory();
                break;

            case Manufacturer.Lenovo:
                partFactory = new LenovoPartFactory();
                break;

            default:
                throw new NotImplementedException();
            }

            var computerCase = (Case)partFactory.CreatePart(PartType.Case);
            var motherboard  = (Motherboard)partFactory.CreatePart(PartType.Motherboard);
            var graphicsCard = partFactory.CreatePart(PartType.GraphicsCard);
            var memory       = partFactory.CreatePart(PartType.Memory);
            var networkcard  = partFactory.CreatePart(PartType.NetworkCard);
            var processor    = partFactory.CreatePart(PartType.Processor);

            computerCase.AttachPart(motherboard);
            motherboard.AttachPart(graphicsCard);
            motherboard.AttachPart(memory);
            motherboard.AttachPart(networkcard);
            motherboard.AttachPart(processor);

            computer = computerCase;
        }
 public StaffingResourceSummaryViewModel(IDomainUnitOfWorkManager<IDomainUnitOfWork> unitOfWorkManager,
                                         IPartFactory<StaffingResourceNameEditorViewModel> nameEditorFactory,
                                         IErrorHandler errorHandler, IDialogManager dialogManager)
     : base(unitOfWorkManager, errorHandler)
 {
     _nameEditorFactory = nameEditorFactory;
     _dialogManager = dialogManager;
 }
 public StaffingResourcePhoneListViewModel(IDomainUnitOfWorkManager<IDomainUnitOfWork> unitOfWorkManager,
                                           IPartFactory<ItemSelectorViewModel> phoneTypeSelectorFactory,
                                           IErrorHandler errorHandler, IDialogManager dialogManager)
     : base(unitOfWorkManager, errorHandler)
 {
     _phoneTypeSelectorFactory = phoneTypeSelectorFactory;
     _dialogManager = dialogManager;
 }
示例#4
0
 public TankManager(IBattleOperator battleOperator)
 {
     this.battleOperator   = battleOperator;
     this.vehicles         = new Dictionary <string, IVehicle>();
     this.parts            = new Dictionary <string, IPart>();
     this.defeatedVehicles = new List <string>();
     this.vehicleFactory   = new VehicleFactory();
     this.partFactory      = new PartFactory();
 }
 public StaffingResourceAddressListViewModel(IDomainUnitOfWorkManager<IDomainUnitOfWork> unitOfWorkManager,
                                             IPartFactory<ItemSelectorViewModel> addressTypeSelectorFactory,
                                             IErrorHandler errorHandler, IDialogManager dialogManager)
     : base(unitOfWorkManager, errorHandler)
 {
     _unitOfWorkManager = unitOfWorkManager;
     _addressTypeSelectorFactory = addressTypeSelectorFactory;
     _dialogManager = dialogManager;
 }
示例#6
0
        public TankManager(IBattleOperator battleOperator, IVehicleFactory vehicleFactory, IPartFactory partFactory)
        {
            this.battleOperator = battleOperator;

            this.vehicles         = new Dictionary <string, IVehicle>();
            this.defeatedVehicles = new List <string>();

            this.vehicleFactory = vehicleFactory;
            this.partFactory    = partFactory;
        }
 public StaffingResourceRatesViewModel(IDomainUnitOfWorkManager<IDomainUnitOfWork> unitOfWorkManager,
                                       IPartFactory<ItemSelectorViewModel> rateTypeSelectorFactory,
                                       IErrorHandler errorHandler, IDialogManager dialogManager)
     : base(unitOfWorkManager, errorHandler)
 {
     // ReSharper disable DoNotCallOverridableMethodsInConstructor
     DisplayName = "Rates";
     // ReSharper restore DoNotCallOverridableMethodsInConstructor
     _rateTypeSelectorFactory = rateTypeSelectorFactory;
     _dialogManager = dialogManager;
 }
示例#8
0
        public Manager(IBattleOperator battleOperator)
        {
            this.battleOperator = battleOperator;

            this.partFactory     = new PartFactory();
            this.aircraftFactory = new AirCraftFactory();

            this.aircrafts         = new Dictionary <string, IAirCraft>();
            this.parts             = new Dictionary <string, IPart>();
            this.defeatedAircrafts = new List <string>();
        }
示例#9
0
        static void Main(string[] args)
        {
            IPartFactory   factory  = null;
            ProductionLine prodLine = new ProductionLine();
            bool           quit     = false;

            while (!quit)
            {
                Console.WriteLine("how many tesla do you want? ");
                int pieces = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("What model? (S, Y, Cybertruck)\n(You can quit with the \"Quit\" command)");
                string model = Console.ReadLine();
                switch (model)
                {
                case "S":
                    factory = new ModelSFactory();
                    break;

                case "Y":
                    factory = new ModelYFactory();
                    break;

                case "Cybertruck":
                    factory = new CybertruckFactory();
                    break;

                case "Quit":
                    quit = true;
                    break;

                default:
                    break;
                }
                prodLine.SetFactory(factory);
                prodLine.StartProduction(pieces);
            }
        }
示例#10
0
 public ReplyCommandTranslator(IPartFactory partFactory, CommandFactory commandFactory, ReplyFactory replyFactory)
 {
     _partFactory    = partFactory;
     _commandFactory = commandFactory;
     _replyFactory   = replyFactory;
 }
 public ConfirmationCommandTranslator(IPartFactory partFactory, CommandFactory commandFactory, ConfirmationFactory confirmationFactory)
 {
     _partFactory         = partFactory;
     _commandFactory      = commandFactory;
     _confirmationFactory = confirmationFactory;
 }
示例#12
0
 public void SetFactory(IPartFactory factory)
 {
     this.factory = factory;
 }
示例#13
0
 public CommandFactory(char separator, IPartFactory factory, CommandFactoryAutoFacAdapter commandFactory)
 {
     _separator      = separator;
     _factory        = factory;
     _commandFactory = commandFactory ?? throw new ArgumentNullException(nameof(commandFactory));
 }
示例#14
0
 protected Command(IList <string> arguments)
 {
     this.arguments       = arguments;
     this.partFactory     = new PartFactory();
     this.aircraftFactory = new AirCraftFactory();
 }
示例#15
0
 public OrderCommandTranslator(IPartFactory partFactory, CommandFactory commandFactory, OrderFactory orderFactory)
 {
     _partFactory    = partFactory;
     _commandFactory = commandFactory;
     _orderFactory   = orderFactory;
 }