コード例 #1
0
ファイル: RecipesListViewModel.cs プロジェクト: tbravenec/5
        public override void Load()
        {
            Recipes.Clear();
            var recipes = recipesRepository.GetAll();

            Recipes.AddRange(recipes);
        }
コード例 #2
0
ファイル: Day14.cs プロジェクト: crypto-rsa/AdventOfCode
            public void Step()
            {
                int newNumber = Recipes[_indices[0]] + Recipes[_indices[1]];

                Recipes.AddRange(_digits[newNumber]);

                _indices[0] = (_indices[0] + Recipes[_indices[0]] + 1) % Recipes.Count;
                _indices[1] = (_indices[1] + Recipes[_indices[1]] + 1) % Recipes.Count;

                for (; ; _inputDigitsNextCheckPosition++)
                {
                    if (InputDigitsFoundAt >= 0)
                    {
                        break;
                    }

                    if (_inputDigitsNextCheckPosition >= Recipes.Count)
                    {
                        break;
                    }

                    if (Recipes[_inputDigitsNextCheckPosition] == _inputDigits[_inputDigitsNextCheckIndex])
                    {
                        if (++_inputDigitsNextCheckIndex == _inputDigits.Length)
                        {
                            InputDigitsFoundAt = _inputDigitsNextCheckPosition - _inputDigits.Length + 1;
                        }
                    }
                    else
                    {
                        _inputDigitsNextCheckIndex = 0;
                    }
                }
            }
コード例 #3
0
ファイル: Day14.cs プロジェクト: toha73/advent-of-code-2018
            public void CreateNewRecipe()
            {
                var newRecipes = CalculateNewRecipes();

                Recipes.AddRange(newRecipes);
                Elf1Index = (Elf1Index + Recipes[Elf1Index] + 1) % Recipes.Count;
                Elf2Index = (Elf2Index + Recipes[Elf2Index] + 1) % Recipes.Count;
            }
コード例 #4
0
 /// <summary>Loads the default game mill products.</summary>
 private void LoadDefaultRecipes()
 {
     Recipes.AddRange(new List <Recipe>()
     {
         new Recipe(271, new Output(423, 1)), // unmilled rice/rice
         new Recipe(262, new Output(246, 1)), // wheat/flour
         new Recipe(284, new Output(245, 3))  // beet/sugar
     });
 }
コード例 #5
0
        // Private methods
        private async Task LoadRecipes()
        {
            var result = await _recipeService.GetRecipesAsync(_nextPage);

            if (string.IsNullOrEmpty(_nextPage))
            {
                Recipes.Clear();
            }
            Recipes.AddRange(result.Results);

            _nextPage = result.Next;
        }
コード例 #6
0
        public async void SearchRecipe()
        {
            Recipes.Clear();
            IEnumerable <Recipe> data;

            if (_currentRecipeType == RecipeType.Cooking)
            {
                data = BdoDataService.GetCookingRecipeByName(SearchStr);
                await Task.CompletedTask;
            }
            else
            {
                data = BdoDataService.GetAlchemyRecipeByName(SearchStr);
                await Task.CompletedTask;
            }

            Recipes.AddRange(data);
            NotifyOfPropertyChange(() => Recipes);
        }
コード例 #7
0
        public async Task LoadDataAsync(RecipeType recipeType)
        {
            _currentRecipeType = recipeType;
            Recipes.Clear();
            IEnumerable <Recipe> data;

            if (recipeType == RecipeType.Cooking)
            {
                data = BdoDataService.AllCookingRecipes();
                await Task.CompletedTask;
            }
            else
            {
                data = BdoDataService.AllAlchemyRecipes();
                await Task.CompletedTask;
            }

            Recipes.AddRange(data);
            NotifyOfPropertyChange(() => Recipes);
        }
コード例 #8
0
 public TradeSet(string name, params ItemRecipe[] recipes)
 {
     Name = name;
     Recipes.AddRange(recipes);
 }