Example #1
0
 public PokemonService(IUserService _userService, IUserRepository _userRepository, IPokemonRepository _pkRepository, IMapper _mapper)
 {
     userService    = _userService;
     userRepository = _userRepository;
     pkRepository   = _pkRepository;
     mapper         = _mapper;
 }
        public TeamSelectionWindow(
            IPokemonRepository pokemonRepository,
            IOptions <PersistentConfig> options,
            ISpriteProvider spriteProvider,
            IConfigRepository configRepository)
        {
            InitializeComponent();

            // Set Title
            Text = "Select Team";

            _configRepository  = configRepository;
            _config            = options;
            _spriteProvider    = spriteProvider;
            _pokemonRepository = pokemonRepository;
            _workingConfig     = new Team();
            _player            = 1;
            _selected          = new Stack <SpriteButton>();
            _ignoreFiredSelectionEventsFlag = false;

            _teamImages = new[]
            {
                PictureTeamFirst,
                PictureTeamSecond,
                PictureTeamThird,
                PictureTeamFourth,
                PictureTeamFifth,
                PictureTeamSixth
            };
        }
        public PaginationType(IPokemonRepository pokemonRepository)
        {
            Field(a => a.count, type: typeof(IntGraphType));
            Field(a => a.first, type: typeof(IntGraphType));
            Field(a => a.last, type: typeof(IntGraphType));
            Field(a => a.startCursor, type: typeof(IntGraphType));
            Field(a => a.endCursor, type: typeof(IntGraphType));
            Field(a => a.totalPages, type: typeof(IntGraphType));
            Field(a => a.hasNextPage, type: typeof(BooleanGraphType));
            Field(a => a.currentPage, type: typeof(BooleanGraphType));
            Field(a => a.sortBy, type: typeof(StringGraphType));
            Field <ListGraphType <PokemonType> >(
                "Pokemons",
                resolve: context =>
            {
                if (context.Source.countPerPage != 0)
                {
                    var start = context.Source.countPerPage * (context.Source.currentPage - 1) + 1;
                    var end   = start + context.Source.countPerPage;
                    if (context.Source.after != 0)
                    {
                        start += context.Source.after;
                        end   += context.Source.after;
                    }
                    else if (context.Source.first != 0)
                    {
                        if (end > context.Source.first)
                        {
                            end = context.Source.first + 1;
                        }
                    }
                    //return pokemonRepository.GetPokemonPagination(first: start, last: end);

                    if (!string.IsNullOrEmpty(context.Source.sortBy))
                    {
                        return(pokemonRepository.GetPokemonPagination(first: start, last: end, sortBy: context.Source.sortBy));
                    }
                    else
                    {
                        return(pokemonRepository.GetPokemonPagination(first: start, last: end));
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(context.Source.sortBy))
                    {
                        return(pokemonRepository.GetPokemonPagination(first: context.Source.first, after: context.Source.after, sortBy: context.Source.sortBy));
                    }
                    else
                    {
                        return(pokemonRepository.GetPokemonPagination(first: context.Source.first, after: context.Source.after));
                    }
                }
            }
                );
            Field <PageInfoType>(
                "PageInfo",
                resolve: context => new PageInfo(1, 1, false));
        }
        public PokemonQuery(IPokemonRepository pokemonRepository)
        {
            Field <ListGraphType <PokemonType> >(
                "AllPokemons",
                resolve: context => pokemonRepository.GetPokemons()
                );

            Field <PokemonType>(
                "PokemonById",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),
                resolve: context => pokemonRepository.GetPokemonById((context.GetArgument <int>("id")))
                );

            Field <PaginationType>(
                "PokemonPagination",
                arguments: new QueryArguments(
                    new QueryArgument <IntGraphType> {
                Name = "first", DefaultValue = 0
            },
                    new QueryArgument <IntGraphType> {
                Name = "after", DefaultValue = 0
            },
                    new QueryArgument <IntGraphType> {
                Name = "countPerPage", DefaultValue = 0
            },
                    new QueryArgument <IntGraphType> {
                Name = "currentPage", DefaultValue = 0
            },
                    new QueryArgument <StringGraphType> {
                Name = "sortBy"
            }
                    ),
                resolve: context =>
            {
                int totalCount;
                int totalPage;
                var temp = context.GetArgument <int>("countPerPage");
                using (var ctx = new PokemonContext())
                {
                    totalCount = ctx.PokemonData.Count();
                    if (context.GetArgument <int>("countPerPage") != 0 && context.GetArgument <int>("first") != 0)
                    {
                        totalPage = (int)Math.Ceiling((double)context.GetArgument <int>("first") / temp);
                    }
                    else if (context.GetArgument <int>("countPerPage") != 0)
                    {
                        totalPage = (int)Math.Ceiling((double)ctx.PokemonData.Count() / temp);
                    }
                    else
                    {
                        totalPage = 0;
                    }
                }
                return(new Pagination(totalCount, context.GetArgument <int>("first"), context.GetArgument <int>("after"), context.GetArgument <int>("countPerPage"), context.GetArgument <int>("currentPage"), totalPage, context.GetArgument <string>("sortBy")));
            }
                );
        }
Example #5
0
        public PokedexViewModel(IPokemonRepository pokemonsRepository, INavigationService navigationService)
        {
            this._navigationService  = navigationService;
            this._pokemonsRepository = pokemonsRepository;

            ReverseOrderCommand = new RelayCommand(OnReverseOrder);
            SearchCommand       = new RelayCommand(navigationService.NavigateToSearchPage);
        }
Example #6
0
 public PokemonManager(IPokemonRepository pokemonRepository
                       , IPokeAPIRepository pokeAPIRepository
                       , IShakespeareWebAppRepository shakespeareWebAppRepository)
 {
     _pokemonRepository           = pokemonRepository;
     _pokeAPIRepository           = pokeAPIRepository;
     _shakespeareWebAppRepository = shakespeareWebAppRepository;
 }
Example #7
0
 public PokemonProvider(
     IProbabilityUtility probabilityUtility,
     IPokemonRepository pokemonRepository,
     IOptions <PersistentConfig> pokemonGeneratorConfig)
 {
     _probabilityUtility = probabilityUtility;
     _pokemonRepository  = pokemonRepository;
     _config             = pokemonGeneratorConfig;
 }
Example #8
0
 public PokedexViewModel(IPokemonRepository pokemonsRepository, INavigationService navigationService)
 {
     this._navigationService  = navigationService;
     this._pokemonsRepository = pokemonsRepository;
     _pokemonDetailViewModel  = Startup.ServiceProvider.GetService <PokemonDetailViewModel>();
     ReverseOrderCommand      = new RelayCommand(OnReverseOrder);
     SearchCommand            = new RelayCommand(navigationService.NavigateToSearchPage);
     SelectPokemonCommand     = new RelayCommand <ItemClickEventArgs>(async(args) => await OnPokemonSelected(args.ClickedItem as Pokemon));
 }
Example #9
0
 // Constructor //-------------------------------------------------------------------------------------------------------------------------------
 public PokemonService(
     IMapper mapper,
     ITypingRepository typeRepository, IPokemonRepository pokemonRepository,
     IConvertHelper convertHelper)
 {
     _mapper            = mapper;
     _typeRepository    = typeRepository;
     _pokemonRepository = pokemonRepository;
     _convertHelper     = convertHelper;
 }
        public PokemonGetByNumberHandler(IPokemonExternalService pokemonExternalService,
                                         IPokemonRepository pokemonRepository)
        {
            _pokemonExternalService = pokemonExternalService;
            _pokemonRepository      = pokemonRepository;

            TypeAdapterConfig <GetPokemonDto, AddPokemonRepositoryDto>
            .NewConfig()
            .Ignore(dest => dest.DateCreated);
        }
Example #11
0
 public SimulationApplication(
     IPokemonRepository pokemonRepository,
     IMoveRepository moveRepository,
     ITypeAdvantageRepository typeAdvantageRepository,
     CacheDomain cacheDomain)
 {
     _pokemonRepository       = pokemonRepository;
     _moveRepository          = moveRepository;
     _typeAdvantageRepository = typeAdvantageRepository;
     _cacheDomain             = cacheDomain;
 }
 public PokemonMoveProvider(
     IPokemonRepository pokemonRepository,
     IProbabilityUtility probabilityUtility,
     IOptions <PersistentConfig> config,
     Random random)
 {
     _pokemonRepository  = pokemonRepository;
     _probabilityUtility = probabilityUtility;
     _random             = random;
     _config             = config;
 }
 public PokemonApplication(
     IPokemonRepository pokemonRepository,
     IPokemonSpeciesRepository pokemonSpeciesRepository,
     IMoveRepository moveRepository,
     INatureRepository natureRepository, CacheDomain cacheDomain)
 {
     _pokemonRepository        = pokemonRepository;
     _pokemonSpeciesRepository = pokemonSpeciesRepository;
     _moveRepository           = moveRepository;
     _natureRepository         = natureRepository;
     _cacheDomain = cacheDomain;
 }
 public PokemonDescriptionService(ILogger <PokemonDescriptionService> logger
                                  , IPokemonRepository pokemonRepo
                                  , ITranslationService translationService
                                  , IFeatureManager featureManager
                                  )
 {
     _logger             = logger;
     _pokemonRepo        = pokemonRepo;
     _translationService = translationService;
     _featureManager     = featureManager;
     _random             = new Random();
 }
Example #15
0
        public PokemonDetailViewModel(
            IPokemonRepository pokemonRepository,
            IMoveRepository moveRepository,
            IEvolutionsRepository evolutionRepository,
            INavigationService navigationService)
        {
            _evolutionRepository = evolutionRepository;
            _navigationService   = navigationService;
            _moveRepository      = moveRepository;
            _pokemonRepository   = pokemonRepository;

            PreviousCommand = new RelayCommand(async() => await SetNewPokemon(await pokemonRepository.GetPreviousPokemon(SelectedPokemon.DexNumber)), () => pokemonRepository.HasPreviousPokemon(SelectedPokemon.DexNumber));
            NextCommand     = new RelayCommand(async() => await SetNewPokemon(await pokemonRepository.GetNextPokemon(SelectedPokemon.DexNumber)), () => pokemonRepository.HasNextPokemon(SelectedPokemon.DexNumber));
        }
Example #16
0
        public PokemonSelectionWindow(
            IPokemonRepository pokemonRepository,
            IOptions <PersistentConfig> options,
            ISpriteProvider spriteProvider,
            IConfigRepository configRepository) : base(options, configRepository)
        {
            InitializeComponent();

            // Set Title
            Text = "Select Pokemon";

            _pokemonRepository = pokemonRepository;
            _spriteProvider    = spriteProvider;
        }
Example #17
0
     public PaginationQuery(IPokemonRepository pokemonRepository)
     {
         Field<PaginationType>(
             "PokemonPagination",
             arguments: new QueryArguments(new QueryArgument<IntGraphType> { Name = "first" }), new QueryArguments(new QueryArgument<IntGraphType> { Name = "last" }),
             resolve: context =>
                 {
                     int totalCount;
                     using (var ctx = new PokemonContext())
                     {
                         totalCount = ctx.PokemonData.Count();
                     }
                     return new Pagination(totalCount, context.GetArgument<int>("first"), context.GetArgument<int>("last"));
                 }
             );
 }
        public PokemonEditorViewModel(IPokemonRepository pokemonRepository,
            IPokemonTypeRepository typeRepository,
            IPokemonSerializer pokemonSerializer)
        {
            Check.IfIsNull(pokemonRepository).Throw<ArgumentNullException>(() => pokemonRepository);
            Check.IfIsNull(typeRepository).Throw<ArgumentNullException>(() => typeRepository);

            Pokemons = new ObservableCollection<IPokemon>(pokemonRepository.SelectAll());
            PokemonTypes = new ObservableCollection<IPokemonType>(typeRepository.SelectAll());

            AddNewPokemonCommand = new Command(AddNewPokemon);
            DeletePokemonCommand = new Command(DeletePokemon, CanDeletePokemon);
            SavePokemonCommand = new Command(SavePokemon);

            this.pokemonSerializer = pokemonSerializer;
        }
Example #19
0
 public DataService(ApplicationContext context,
                    IPokemonRepository pokemonRepository,
                    ITypeElementRepository typeElementRepository,
                    IPokemonTypeElementRepository pokemonTypeElementRepository,
                    IPokemonWeaknessRepository pokemonWeaknessRepository,
                    IPokemonNextEvolutionRepository pokemonNextEvolutionRepository,
                    IPokemonPrevEvolutionRepository pokemonPrevEvolutionRepository)
 {
     this.context                        = context;
     this.pokemonRepository              = pokemonRepository;
     this.typeElementRepository          = typeElementRepository;
     this.pokemonTypeElementRepository   = pokemonTypeElementRepository;
     this.pokemonWeaknessRepository      = pokemonWeaknessRepository;
     this.pokemonNextEvolutionRepository = pokemonNextEvolutionRepository;
     this.pokemonPrevEvolutionRepository = pokemonPrevEvolutionRepository;
 }
        public PlayerOptionsGroupBox()
        {
            _spriteProvider    = DependencyInjector.Get <ISpriteProvider>();
            _optionsValidator  = DependencyInjector.Get <IPokeGeneratorOptionsValidator>();
            _pokemonRepository = DependencyInjector.Get <IPokemonRepository>();
            _options           = DependencyInjector.Get <IOptions <PersistentConfig> >();

            // Init
            InitializeComponent();
            GroupBox.Text = Text;
            SelectPlayerVersion.DataSource = new[] { "Gold", "Silver" };
            _teamImages = new[]
            {
                PictureTeamFirst,
                PictureTeamSecond,
                PictureTeamThird,
                PictureTeamFourth,
                PictureTeamFifth,
                PictureTeamSixth
            };
        }
Example #21
0
 public PokemonService()
 {
     _repository = new PokemonRepository();
 }
Example #22
0
 public PokemonService(IPokemonRepository respository)
 {
     _repository = respository;
 }
Example #23
0
 public QuestionController(IPokemonRepository pokemonRepository, IUserRepository userRepository)
 {
     _pokemonRepository = pokemonRepository;
     _userRepository    = userRepository;
 }
Example #24
0
 public PokemonService(IPokemonRepository pokemonRepository, IDifficultyRepository difficultyRepository)
 {
     this.pokemonRepository    = pokemonRepository;
     this.difficultyRepository = difficultyRepository;
 }
Example #25
0
 public PokemonController(IPokemonRepository pokemonRepository)
 {
     _pokemonRepository = pokemonRepository;
 }
Example #26
0
 public PokemonNextEvolutionRepository(ApplicationContext context, IPokemonRepository pokemonRepository) : base(context)
 {
     _pokemonRepository = pokemonRepository;
 }
 public PokemonController(IPokemonRepository _pokemonRepository)
 {
     pokemonRepository = _pokemonRepository;
 }
 public PokemonServices(IPokemonRepository repository)
 {
     this._repository = repository;
 }
Example #29
0
 public SearchViewModel(IPokemonRepository pokemonsRepository, IMoveRepository moveRepository, INavigationService navigationService)
 {
     this.navigationService  = navigationService;
     this.moveRepository     = moveRepository;
     this.pokemonsRepository = pokemonsRepository;
 }
Example #30
0
 public PokemonsController(IPokemonRepository pokemonRepository, IMapper mapper, IPokemonService pokemonService)
 {
     _pokemonRepository = pokemonRepository;
     _mapper            = mapper;
     _pokemonService    = pokemonService;
 }
 public PokemonController(IPokemonRepository repository)
 {
 }
Example #32
0
 public SearchController(IPokemonRepository repo)
 {
     repository = repo;
 }
Example #33
0
 public PokemonFactory(IPokemonRepository repository, IPokemonRules rules)
 {
     this.rules = rules;
     this.repository = repository;
 }