Esempio n. 1
0
        public void SetUp()
        {
            _input       = new MockInput();
            _output      = new MockOutput();
            _menuFactory = new MenuFactory();
            _manager     = new MenuManager(_input, _output, _menuFactory);
            _logger      = new EventLogger();
            _playerOne   = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1, "swordsman");
            Spell fireSpell = SpellFactory.GetSpell(MagicType.Fire, 1);

            _playerOne.AddSpell(fireSpell);
            _playerOne.SetMana(fireSpell.Cost);

            _playerTwo   = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1, "mage");
            _playerThree = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1, "alchemist");
            _playerTeam  = new Team(_manager, _playerOne, _playerTwo, _playerThree);

            _enemyTeam = new Team(_manager, new List <IFighter>
            {
                FighterFactory.GetFighter(FighterType.Goblin, 1),
                FighterFactory.GetFighter(FighterType.Goblin, 1),
                FighterFactory.GetFighter(FighterType.Goblin, 1)
            });

            _manager.InitializeForBattle(_playerTeam, _enemyTeam);
        }
Esempio n. 2
0
 public MainMenuViewModel(IMenuRegisterService registerService, IMenuFactory menuFactory, ILogger logger)
 {
     MenuRegisterService = registerService;
     _menuFactory = menuFactory;
     _logger = logger;
     _logger.Log("Initialized {ClassName:l}", Category.Info, null, GetType().FullName);
 }
        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="menuFactory">Referense till en factory där man kan hämta text till olika menyer</param>
        /// <param name="ui">Referense till objekt för att skriva och hämta indata</param>
        /// <param name="lsGarageHandlers">lista med olika garagehandlers. Varje garagehandler hanterar ett garage</param>
        /// <param name="guidSelectedGarageHandlerGuid">Guid för vald GarageHandler</param>
        /// <param name="registrationNumberRegister">Referense till register där använda registreringsnummer finns</param>
        /// <exception cref="System.NullReferenceException">Kan kastas om referensen till menuFactory, vehicleFactory, ui, lsGarageHandlers eller registrationNumberRegister är null</exception>
        public GarageMenu(IMenuFactory menuFactory, IUI ui, IList <IGarageHandler> lsGarageHandlers, Guid guidSelectedGarageHandlerGuid, IRegistrationNumberRegister registrationNumberRegister)
        {
            if (menuFactory == null)
            {
                throw new NullReferenceException("NullReferenceException. GarageMenu.GarageMenu(). menuFactory referensen är null");
            }

            if (ui == null)
            {
                throw new NullReferenceException("NullReferenceException. GarageMenu.GarageMenu(). ui referensen är null");
            }

            if (lsGarageHandlers == null)
            {
                throw new NullReferenceException("NullReferenceException. GarageMenu.GarageMenu(). lsGarageHandlers referensen är null");
            }

            if (registrationNumberRegister == null)
            {
                throw new NullReferenceException("NullReferenceException. GarageMenu.GarageMenu(). registrationNumberRegister referensen är null");
            }

            MenuFactory                = menuFactory;
            Ui                         = ui;
            GarageHandlers             = lsGarageHandlers;
            SelectedGarageHandlerGuid  = guidSelectedGarageHandlerGuid;
            RegistrationNumberRegister = registrationNumberRegister;
        }
Esempio n. 4
0
        public IActionResult Create([FromBody] Models.Menu menu)
        {
            IActionResult result = null;

            if (menu == null)
            {
                result = BadRequest("Missing menu data");
            }

            if (result == null)
            {
                using (ILifetimeScope scope = m_container.BeginLifetimeScope())
                {
                    IMenuFactory factory   = scope.Resolve <IMenuFactory>();
                    IMenu        innerMenu = factory.Create();
                    IMapper      mapper    = new Mapper(m_mapperConfiguration);
                    mapper.Map <Models.Menu, IMenu>(menu, innerMenu);

                    if (string.IsNullOrEmpty(innerMenu.Title))
                    {
                        result = BadRequest("Missing title");
                    }

                    if (result == null)
                    {
                        IMenuSaver saver = scope.Resolve <IMenuSaver>();
                        saver.Create(m_settings.Value, innerMenu);
                        result = Ok(mapper.Map <Models.Menu>(innerMenu));
                    }
                }
            }

            return(result);
        }
Esempio n. 5
0
 public PostCommand(ISession session, IPostService postService,
                    IMenuFactory menuFactory)
 {
     this.session     = session;
     this.postService = postService;
     this.menuFactory = menuFactory;
 }
Esempio n. 6
0
        public RegionManager(
            IRegionFactory regionFactory,
            IMapManager mapManager,
            ITeamFactory teamFactory,
            IMenuFactory menuFactory,
            IDecisionManager decisionManager,
            BattlefieldFactory battlefieldFactory,
            IInput input,
            IOutput output,
            IChanceService chanceService)
        {
            _mapManager         = mapManager;
            _teamFactory        = teamFactory;
            _decisionManager    = decisionManager;
            _menuFactory        = menuFactory;
            _battlefieldFactory = battlefieldFactory;

            _input         = input;
            _output        = output;
            _chanceService = chanceService;

            IEnumerable <WorldRegion> allRegionEnums = EnumHelperMethods.GetAllValuesForEnum <WorldRegion>();
            IEnumerable <Region>      allRegions     = regionFactory.GetRegions(allRegionEnums);

            _regionalMap = mapManager.GetRegionalMap(allRegions.ToArray());
        }
Esempio n. 7
0
        public static IMenu[] MainMenus(IMenuFactory factory)
        {
            var foos = factory.NewMenu <FooService>(true);
            var bars = factory.NewMenu <BarService>(true);

            var q = factory.NewMenu <QuxService>(false, "Qs");

            q.AddAction("QuxAction0");
            q.AddAction("QuxAction3", "Action X");
            q.AddRemainingNativeActions();

            var subs = factory.NewMenu <ServiceWithSubMenus>(false);
            var sub1 = subs.CreateSubMenuOfSameType("Sub1");

            sub1.AddAction("Action1");
            sub1.AddAction("Action3");
            var sub2 = subs.CreateSubMenuOfSameType("Sub2");

            sub2.AddAction("Action2");
            sub2.AddAction("Action0");

            var hyb = factory.NewMenu("Hybrid");

            hyb.AddActionFrom <FooService>("FooAction0");
            hyb.AddActionFrom <BarService>("BarAction0");
            hyb.AddAllRemainingActionsFrom <QuxService>();

            var empty = factory.NewMenu("Empty");

            var empty2 = factory.NewMenu("Empty2");

            empty2.CreateSubMenu("Sub");

            return(new IMenu[] { foos, bars, q, subs, hyb, empty, empty2 });
        }
Esempio n. 8
0
 public Bell(string displayName, BellType bellType, IMenuFactory menuFactory, IChanceService chanceService)
     : base(displayName)
 {
     BellType      = bellType;
     MenuFactory   = menuFactory;
     ChanceService = chanceService;
 }
        public ObjectExplorerPresenter(IObjectExplorerView view)
        {
            nodesForItem = new Dictionary <ObjectExplorerItem, List <ITreeNode> >();

            View = view;

            view.Loaded          += View_Load;
            view.NodeMouseClick  += View_NodeMouseClick;
            view.NodeAfterSelect += View_NodeAfterSelect;

            Container = ContainerDelivery.GetContainer();

            TreeNodeFactory = Container.Resolve <ITreeNodeFactory>();
            ObjectExplorerRepositoryFactory = Container.Resolve <IObjectExplorerRepositoryFactory>();
            MenuFactory = Container.Resolve <IMenuFactory>();
            CommandBus  = Container.Resolve <ICommandBus>();

            documentsController = Container.Resolve <IDocumentsController>();
            documentsController.DocumentActivationChanged += DocumentsController_DocumentActivationChanged;

            documentConnector = Container.Resolve <IDocumentConnector>();
            documentConnector.ConnectingStarted  += DocumentConnector_ConnectingStarted;
            documentConnector.ConnectingFinished += DocumentConnector_ConnectingFinished;
            documentConnector.Disconnected       += DocumentConnector_Disconnected;
        }
        private static IMenu[] CombinedNOandNFMenus(IMenuFactory mf)
        {
            var menus = ModelConfig_NakedFunctionsPM.MainMenus(mf).ToList();

            //menus.AddRange(ModelConfig_NakedObjectsPM.MainMenus(mf));
            return(menus.ToArray());
        }
 public MenuService(IMenuQuery menuQuery, IMenuRepository menuRepository, IMenuValidator menuValidator, IMenuFactory menuFactory)
 {
     _menuQuery      = menuQuery;
     _menuRepository = menuRepository;
     _menuValidator  = menuValidator;
     _menuFactory    = menuFactory;
 }
        public MainViewModel(IMenuFactory menuFactory)
        {
            _menuFactory = menuFactory;


            LoadMenu();
        }
Esempio n. 13
0
        public TaskbarIconViewModel(IMenuFactory menuFactory, IWindowsManager windowsManager)
        {
            this.menuFactory    = menuFactory;
            this.windowsManager = windowsManager;

            InitMenuItems();
        }
Esempio n. 14
0
 public BattlefieldFactory(ITeamFactory teamFactory, GroupingFactory groupingFactory, IMenuFactory menuFactory, IChanceService chanceService)
 {
     _teamFactory     = teamFactory;
     _groupingFactory = groupingFactory;
     _menuFactory     = menuFactory;
     _chanceService   = chanceService;
 }
        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="menuFactory">Referens till factory för att skapa menyer</param>
        /// <param name="ui">Referens till ui</param>
        /// <param name="lsGarageHandlers">Referense till lista med handlers för olika garage</param>
        /// <param name="registrationNumberRegister">Referense till register där använda registreringsnummer finns</param>
        /// <exception cref="System.NullReferenceException">Kan kastas om referensen till menuFactory, vehicleFactory, ui, lsGarageHandlers eller registrationNumberRegister är null</exception>
        public MainMenu(IMenuFactory menuFactory, IUI ui, IList <IGarageHandler> lsGarageHandlers, IRegistrationNumberRegister registrationNumberRegister)
        {
            //if (menuFactory == null)
            //    throw new NullReferenceException("NullReferenceException. MainMenu.MainMenu(). menuFactory referensen är null");

            if (ui == null)
            {
                throw new NullReferenceException("NullReferenceException. MainMenu.MainMenu(). ui referensen är null");
            }

            if (lsGarageHandlers == null)
            {
                throw new NullReferenceException("NullReferenceException. MainMenu.MainMenu(). lsGarageHandlers referensen är null");
            }

            if (registrationNumberRegister == null)
            {
                throw new NullReferenceException("NullReferenceException. MainMenu.MainMenu(). registrationNumberRegister referensen är null");
            }


            MenuFactory                = menuFactory;
            Ui                         = ui;
            GarageHandlers             = lsGarageHandlers;
            RegistrationNumberRegister = registrationNumberRegister;
        }
        public static IMenu[] MainMenus(IMenuFactory factory)
        {
            var foos = factory.NewMenu <FooService>(true);
            var bars = factory.NewMenu <BarService>(true);

            var q = factory.NewMenu <QuxService>(false, "Qs");

            q.AddAction("QuxAction0");
            q.AddAction("QuxAction3");
            q.AddRemainingNativeActions();

            var subs = factory.NewMenu <ServiceWithSubMenus>();
            var sub1 = subs.CreateSubMenu("Sub1");

            sub1.AddAction("Action1");
            sub1.AddAction("Action3");
            var sub2 = subs.CreateSubMenu("Sub2");

            sub2.AddAction("Action2");
            sub2.AddAction("Action0");

            var hyb = factory.NewMenu("Hybrid", "hybrid");

            hyb.AddAction(typeof(FooService), "FooAction0");
            hyb.AddAction(typeof(BarService), "BarAction0");
            hyb.AddRemainingActions(typeof(QuxService));

            var empty = factory.NewMenu <object>(false, "Empty");

            var empty2 = factory.NewMenu <object>(false, "Empty2");

            empty2.CreateSubMenu("Sub");

            return(new[] { foos, bars, q, subs, hyb, empty, empty2 });
        }
 public static IMenu[] MainMenus(IMenuFactory factory)
 {
     return(new IMenu[] {
         factory.NewMenu <FilmService>(true, "Films"),
         factory.NewMenu <CustomerService>(true, "Customers"),
         factory.NewMenu <RentalService>(true, "Rentals")
     });
 }
 public DeviceInfoViewModel(Device device, IMenuFactory menuFactory)
     : base(device)
 {
     DisconnectDeviceMenu = menuFactory.GetMenuItem(device, MenuItemType.DisconnectDevice);
     RemoveDeviceMenu     = menuFactory.GetMenuItem(device, MenuItemType.RemoveDevice);
     AuthorizeDeviceAndLoadStorageMenu = menuFactory.GetMenuItem(device, MenuItemType.AuthorizeDeviceAndLoadStorage);
     SetAsActiveDeviceMenu             = menuFactory.GetMenuItem(device, MenuItemType.SetAsActiveDevice);
 }
 public FileExplorerContextMenuManager(FileExplorerContextMenu contextMenu, IMenuFactory menuFactory,
                                       VisualStudioIcons visualStudioIcons, IImageProvider imageProvider, IWindowService windowService)
 {
     _contextMenu       = contextMenu;
     _menuFactory       = menuFactory;
     _visualStudioIcons = visualStudioIcons;
     _imageProvider     = imageProvider;
     _windowService     = windowService;
 }
Esempio n. 20
0
 public CreateMenuCommand(
     IDateService dateService,
     IDatabaseService database,
     IMenuFactory factory)
 {
     _dateService = dateService;
     _database    = database;
     _factory     = factory;
 }
        public HumanControlledEnemyFighter(string name, IInput input, IOutput output, IMenuFactory menuFactory)
            : base(name, 1, 1, 0, 0, 0, 0, 0, 0, null)
        {
            ExpGivenOnDefeat = 0;

            _input       = input;
            _output      = output;
            _menuFactory = menuFactory;
        }
Esempio n. 22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="appSettings"></param>
        /// <param name="directory"></param>
        /// <param MenuRepository="dictaatFactory"></param>
        public MenuRepository(IOptions <ConfigVariables> appSettings, IFile file)
        {
            _directoryRoot  = appSettings.Value.DictaatRoot;
            _menuConfigName = appSettings.Value.MenuConfigName;
            _file           = file;

            //best place to build the factory
            _menuFactory = new MenuFactory(appSettings.Value, file);
        }
        public static IMenu[] MainMenus(IMenuFactory factory) {
            var menu1 = factory.NewMenu<RestDataRepository>(true);
            var menu2 = factory.NewMenu<WithActionService>(true);
            var menu3 = factory.NewMenu<ContributorService>(true);
            var menu4 = factory.NewMenu<TestTypeCodeMapper>(true);


            return new[] { menu1, menu2, menu3, menu4 };
        }
Esempio n. 24
0
        public static IMenu[] MainMenus(IMenuFactory factory)
        {
            var menu1 = factory.NewMenu <RestDataRepository>(true);
            var menu2 = factory.NewMenu <WithActionService>(true);
            var menu3 = factory.NewMenu <ContributorService>(true);
            var menu4 = factory.NewMenu <TestTypeCodeMapper>(true);


            return(new IMenu[] { menu1, menu2, menu3, menu4 });
        }
 public static IMenu[] MainMenus(IMenuFactory factory)
 {
     return(new IMenu[] {
         factory.NewMenu <AccountsService>(true, "Accounts"),
         factory.NewMenu <UserService>(true, "Users"),
         factory.NewMenu <AuditService>(true, "Audit"),
         factory.NewMenu <DocumentService>(true, "Documents"),
         factory.NewMenu <EmailService>(true, "Email")
     });
 }
 public static IMenu[] MainMenus(IMenuFactory factory)
 {
     return(new[] {
         factory.NewMenu(typeof(AdventureWorksFunctionalModel.Functions.MenuFunctions), true, "Test Menu"),
         factory.NewMenu(typeof(SpecialOfferRepository), true, "Special Offers"),
         factory.NewMenu(typeof(EmployeeRepository), true, "Employees"),
         factory.NewMenu(typeof(ProductRepository), true, "Products"),
         factory.NewMenu(typeof(PersonRepository), true, "Contacts"),
         factory.NewMenu(typeof(SalesRepository), true, "Sales"),
         factory.NewMenu(typeof(CustomerRepository), true, "Customers")
     });
 }
 public ModelIntegrator(IMetamodelBuilder metamodelBuilder,
                        IMenuFactory menuFactory,
                        ILogger <ModelIntegrator> logger,
                        ICoreConfiguration coreConfiguration,
                        IObjectReflectorConfiguration objectReflectorConfiguration)
 {
     this.metamodelBuilder             = metamodelBuilder;
     this.menuFactory                  = menuFactory;
     this.logger                       = logger;
     this.coreConfiguration            = coreConfiguration;
     this.objectReflectorConfiguration = objectReflectorConfiguration;
 }
Esempio n. 28
0
        public IActionResult GetAll()
        {
            IActionResult result = null;

            using (ILifetimeScope scope = m_container.BeginLifetimeScope())
            {
                IMenuFactory        factory = scope.Resolve <IMenuFactory>();
                IEnumerable <IMenu> menus   = factory.GetAll(m_settings.Value);
                IMapper             mapper  = new Mapper(m_mapperConfiguration);
                result = Ok(menus.Select <IMenu, Models.Menu>(m => mapper.Map <Models.Menu>(m)));
            }
            return(result);
        }
Esempio n. 29
0
        public DecisionManager(GodRelationshipManager godRelationshipManager,
                               IChanceService chanceService = null,
                               IMenuFactory menuFactory     = null,
                               IInput input   = null,
                               IOutput output = null)
        {
            _relationshipManager = godRelationshipManager;
            _chanceService       = chanceService ?? Globals.ChanceService;
            _menuFactory         = menuFactory ?? Globals.MenuFactory;
            _input  = input ?? Globals.Input;
            _output = output ?? Globals.Output;

            _groupingChoicesDictionary = new Dictionary <int, WorldSubRegion>();
        }
Esempio n. 30
0
        public static IMenu[] MainMenus(IMenuFactory factory)
        {
            var claimMenu = factory.NewMenu <ClaimRepository>(false);

            ClaimRepository.Menu(claimMenu);
            return(new[] {
                factory.NewMenu <EmployeeRepository>(true),
                claimMenu,
                factory.NewMenu <DummyMailSender>(true),
                factory.NewMenu <SimpleRepositoryCustomHelperTestClass>(true),
                factory.NewMenu <SimpleRepositoryDescribedCustomHelperTestClass>(true),
                factory.NewMenu <object>(false, "Empty"),  //Should not be rendered
                factory.NewMenu <ServiceWithNoVisibleActions>(true)
            });
        }
 /// <summary>
 /// Return an array of IMenus (obtained via the factory, then configured) to
 /// specify the Main Menus for the application. If none are returned then
 /// the Main Menus will be derived automatically from the Services.
 /// </summary>
 public static IMenu[] MainMenus(IMenuFactory factory) {
     var customerMenu = factory.NewMenu<CustomerRepository>(false);
     CustomerRepository.Menu(customerMenu);
     return new[] {
             customerMenu,
             factory.NewMenu<OrderRepository>(true),
             factory.NewMenu<ProductRepository>(true),
             factory.NewMenu<EmployeeRepository>(true),
             factory.NewMenu<SalesRepository>(true),
             factory.NewMenu<SpecialOfferRepository>(true),
             factory.NewMenu<PersonRepository>(true),
             factory.NewMenu<VendorRepository>(true),
             factory.NewMenu<PurchaseOrderRepository>(true),
             factory.NewMenu<WorkOrderRepository>(true),
             factory.NewMenu<object>(false, "Empty")
     };
 }
        public static IMenu[] MainMenus(IMenuFactory factory)
        {
            var menuDefs = new Dictionary <Type, Action <IMenu> >();

            menuDefs.Add(typeof(FooService), FooService.Menu);
            menuDefs.Add(typeof(BarService), BarService.Menu);
            menuDefs.Add(typeof(ServiceWithSubMenus), ServiceWithSubMenus.Menu);

            var menus = new List <IMenu>();

            foreach (var menuDef in menuDefs)
            {
                var menu = factory.NewMenu(menuDef.Key);
                menuDef.Value(menu);
                menus.Add(menu);
            }
            return(menus.ToArray());
        }
Esempio n. 33
0
        //Any other simple configuration options (e.g. bool or string) on the old Run classes should be
        //moved onto a single SystemConfiguration, which can delegate e.g. to Web.config


        /// <summary>
        /// Return an array of IMenus (obtained via the factory, then configured) to
        /// specify the Main Menus for the application. If none are returned then
        /// the Main Menus will be derived automatically from the Services.
        /// </summary>
        public static IMenu[] MainMenus(IMenuFactory factory)
        {
            var customerMenu = factory.NewMenu <CustomerRepository>(false);

            CustomerRepository.Menu(customerMenu);
            return(new IMenu[] {
                customerMenu,
                factory.NewMenu <OrderRepository>(true),
                factory.NewMenu <ProductRepository>(true),
                factory.NewMenu <EmployeeRepository>(true),
                factory.NewMenu <SalesRepository>(true),
                factory.NewMenu <SpecialOfferRepository>(true),
                factory.NewMenu <ContactRepository>(true),
                factory.NewMenu <VendorRepository>(true),
                factory.NewMenu <PurchaseOrderRepository>(true),
                factory.NewMenu <WorkOrderRepository>(true)
            });
        }
 /// <summary>
 /// Return an array of IMenus (obtained via the factory, then configured) to
 /// specify the Main Menus for the application. If none are returned then
 /// the Main Menus will be derived automatically from the Services.
 /// </summary>
 public static IMenu[] MainMenus(IMenuFactory factory) {
     var customerMenu = factory.NewMenu<CustomerRepository>(false);
     CustomerRepository.Menu(customerMenu);
     var salesMenu = factory.NewMenu<SalesRepository>(false);
     SalesRepository.Menu(salesMenu);
     return new[] {
             customerMenu,
             factory.NewMenu<OrderRepository>(true),
             factory.NewMenu<ProductRepository>(true),
             factory.NewMenu<EmployeeRepository>(true),
             salesMenu,
             factory.NewMenu<SpecialOfferRepository>(true),
             factory.NewMenu<PersonRepository>(true),
             factory.NewMenu<VendorRepository>(true),
             factory.NewMenu<PurchaseOrderRepository>(true),
             factory.NewMenu<WorkOrderRepository>(true),
             factory.NewMenu<ServiceWithNoVisibleActions>(true, "Empty")
     };
 }
 protected override IMenu[] MainMenus(IMenuFactory factory) {
     return DemoServicesSet.MainMenus(factory);
 }
 public static IMenu[] MainMenus(IMenuFactory factory)
 {
     return new IMenu[] {
         factory.NewMenu<CustomerRepository>(true, "Customers")
     };
 }
 /// <summary>
 /// Return an array of IMenus (obtained via the factory, then configured) to
 /// specify the Main Menus for the application. If none are returned then
 /// the Main Menus will be derived automatically from the MenuServices.
 /// </summary>
 public static IMenu[] MainMenus(IMenuFactory factory) {
     return new IMenu[] {};
 }
Esempio n. 38
0
 public MenuApiController()
 {
     MenuFactory = new MenuFacoty();
 }
 public static IMenu[] MainMenus(IMenuFactory factory) {
     //e.g. var menu1 = factory.NewMenu<MyService1>(true); //then add to returned array
     return new IMenu[] {  };
 }