• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Recipe类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Recipe的典型用法代码示例。如果您正苦于以下问题:C# Recipe类的具体用法?C# Recipe怎么用?C# Recipe使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Recipe类属于命名空间,在下文中一共展示了Recipe类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CalculateCost

        public static int CalculateCost(Recipe recipe, List<Ingredient> simIngredients, List<Ingredient> lotIngredients, ref List<Ingredient> toRemoveFromSim, ref List<Ingredient> toRemoveFromFridge, out List<IngredientData> remainingIngredients, bool isSnack)
        {
            if (simIngredients == null || lotIngredients == null)
            {
                remainingIngredients = null;
                return 0;
            }
            remainingIngredients = BuildIngredientList(recipe, simIngredients, lotIngredients, ref toRemoveFromSim, ref toRemoveFromFridge, isSnack);
            int num = 0;
            foreach (IngredientData current in remainingIngredients)
            {
                if (!current.IsAbstract)
                {
                    if (!current.CanBuyFromStore)
                    {
                        return -2147483648;
                    }
                    num += current.Price;
                }
                else
                {
                    IngredientData cheapestIngredientOfAbstractType = IngredientData.GetCheapestIngredientOfAbstractType(current.Key, false);
                    if (cheapestIngredientOfAbstractType != null)
                    {
                        num += cheapestIngredientOfAbstractType.Price;
                    }
                }
            }
            //return num + (int)Math.Ceiling((double)((float)(num * Recipe.kFridgeRestockingPriceMarkupPercentage) / 100f));
            if (num > 0)
                num = -2147483648;

            return num;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:34,代码来源:AniRecipe.cs


示例2: SetFailure

	void SetFailure (Recipe r)
	{
		AudioSource.PlayClipAtPoint(failSound2, transform.position);
		r.isFinished = true;
		r.isSuccessful = false;
		r.currentTimer = 0;
	}
开发者ID:nschroedl,项目名称:GameJamRitual,代码行数:7,代码来源:DeliverVial.cs


示例3: AddSearchResult

        private void AddSearchResult(Recipe recipe)
        {
            var control = new ucSearchResult(recipe);
            control.Dock = DockStyle.Top;

            pcFindRecipe.Controls.Add(control);
        }
开发者ID:ChocolateSlayer,项目名称:CookBook,代码行数:7,代码来源:ucRecipeFind.cs


示例4: PutRecipe

        public IHttpActionResult PutRecipe(int id, Recipe recipe)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != recipe.RecipeId)
            {
                return BadRequest();
            }

            _collector.Recipes.Update(recipe);

            try
            {
                _collector.Save();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_collector.Recipes.ItemExists(id))
                {
                    return NotFound();
                }

                return BadRequest();
            }
            return StatusCode(HttpStatusCode.NoContent);
        }
开发者ID:JakobVork,项目名称:Semesterprojekt4,代码行数:29,代码来源:RecipesController.cs


示例5: PrepareTestResultCheckAndGrayedOutPieMenuSet

        public static string PrepareTestResultCheckAndGrayedOutPieMenuSet(Sim preparer, Recipe recipe, string dishName, bool isSnack)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(Localization.LocalizeString("Gameplay/Objects/FoodObjects/Food:Requires", new object[]
            {
                dishName
            }));

            //If snack, only use one ingredient              
            if (isSnack)
            {
                if (recipe.Ingredient1 != null)
                {
                    sb.Append("\n");
                    sb.Append(recipe.Ingredient1.Name);
                }
            }
            else
            {
                foreach (IngredientData current in recipe.Ingredients.Keys)
                {
                    sb.Append("\n");
                    sb.Append(current.Name);
                    if (recipe.Ingredients[current] > 1)
                    {
                        sb.Append(" (");
                        sb.Append(recipe.Ingredients[current].ToString());
                        sb.Append(")");
                    }
                }
            }
            return sb.ToString();
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:33,代码来源:CommonMethods.cs


示例6: Merge

        partial void Merge(Recipe entity, RecipeDTO dto, object state)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state", "Precondition: state is IResponse");
            }

            var response = state as IResponse;
            if (response == null)
            {
                throw new ArgumentException("Precondition: state is IResponse", "state");
            }

            entity.Culture = response.Culture;
            entity.RecipeId = dto.Id;
            entity.OutputItemId = dto.OutputItemId;
            entity.OutputItemCount = dto.OutputItemCount;
            entity.MinimumRating = dto.MinRating;
            entity.TimeToCraft = TimeSpan.FromMilliseconds(dto.TimeToCraftMs);

            if (dto.Disciplines != null)
            {
                entity.CraftingDisciplines = this.craftingDisciplineCollectionConverter.Convert(dto.Disciplines, dto);
            }

            if (dto.Flags != null)
            {
                entity.Flags = this.recipeFlagCollectionConverter.Convert(dto.Flags, dto);
            }

            if (dto.Ingredients != null)
            {
                entity.Ingredients = this.ingredientsCollectionConverter.Convert(dto.Ingredients, dto);
            }
        }
开发者ID:Waevka,项目名称:GW2.NET,代码行数:35,代码来源:RecipeConverter.cs


示例7: CreateRecipe

        /// <summary>
        /// Creates a new recipe
        /// </summary>
        /// <returns>The recipe or null if aborted</returns>
        private static Recipe CreateRecipe()
        {
            Console.Clear();
            RecipeView.RenderHeader("          Nytt recept          ");
            string name = ReadRecipeName();
            if (name == null) {
                return null;
            }

            Recipe recipe = new Recipe(name);

            List<Ingredient> ingredients = ReadIngredients();
            if (ingredients == null) {
                return null;
            }
            foreach (Ingredient ingredient in ingredients) {
                recipe.Add(ingredient);
            }

            List<string> directions = ReadDirections();
            if (directions == null) {
                return null;
            }
            foreach (string direction in directions) {
                recipe.Add(direction);
            }

            return recipe;
        }
开发者ID:re222dv,项目名称:1DV402-C-sharp,代码行数:33,代码来源:Program.cs


示例8: RecipeIndividualSteps

        public RecipeIndividualSteps(RecipeOverview parentPage, Recipe rec)
        {
            InitializeComponent();

            canvAchievement.Visibility = Visibility.Hidden;
            canvAchievement.Opacity = 0;
            overview = parentPage;
            aRecipe = rec;

            userDb = Database.getInstance();
            mainUser = userDb.userList[0];

            // load first step
            stepIndex = 0;
            lastStep = aRecipe.Steps.Count() - 1;
            txtBlkStep.Text = aRecipe.Steps[stepIndex];
            progBar.Maximum = lastStep;
            lblProg.Content = "Steps " + (progBar.Value + 1) + "/" + (lastStep +1);

            // load picture if exists
            if (aRecipe.StepPictures.Count == lastStep + 1)
                imgStep.Source = ImageLoader.ToWPFImage(aRecipe.StepPictures[stepIndex]);
            else
                imgStep.Source = ImageLoader.ToWPFImage(HCI_Cooking.Properties.Resources.placeholder_2);
            

            //load the only achievment on this page

            imgAchievement.Source = ImageLoader.ToWPFImage(new Bitmap(HCI_Cooking.Properties.Resources.mango_cake));
            lblAchievementContent.Content = "First Mango Pudding!";
        }
开发者ID:kevinta893,项目名称:cpsc481,代码行数:31,代码来源:RecipeIndividualSteps.xaml.cs


示例9: GenerateRecipes

        private void GenerateRecipes()
        {
            var recipe = new Recipe();
            recipe.Name = "Non greasy gamer snacks";
            recipe.Description = "Perfect snacks for gamers wich doesn't make your hands greasy and slippery.";
            recipe.Ingredients.Add(new Ingredient{ Name = "Snack", Amount = "1 bag"});
            recipe.Ingredients.Add(new Ingredient { Name = "Non Greasy Stuff", Amount = "1 l" });

            Recipes.Add(recipe);

            recipe = new Recipe();
            recipe.Name = "Nerd burgers";
            recipe.Description = "The nerdy burger is perfect for NerdDinner(s)";
            recipe.Ingredients.Add(new Ingredient { Name = "Burger", Amount = "4" });
            recipe.Ingredients.Add(new Ingredient { Name = "Ners", Amount = "4" });

            Recipes.Add(recipe);

            recipe = new Recipe();
            recipe.Name = "Potato soup";
            recipe.Description = "Peel the potatoes. Fry the leek and onion for a short while and add water and potatoes. Boil the potatoes... etc.";
            recipe.Ingredients.Add(new Ingredient { Name = "Potatoes", Amount = "12" });
            recipe.Ingredients.Add(new Ingredient { Name = "Water", Amount = "0.6 litres" });
            recipe.Ingredients.Add(new Ingredient { Name = "Bouillon cubes (meat)", Amount = "2" });
            recipe.Ingredients.Add(new Ingredient { Name = "Onion", Amount = "1" });
            recipe.Ingredients.Add(new Ingredient { Name = "Leek", Amount = "0.5" });
            recipe.Ingredients.Add(new Ingredient { Name = "Creme fraiche", Amount = "1 dl" });

            Recipes.Add(recipe);
        }
开发者ID:jenspettersson,项目名称:Fooder,代码行数:30,代码来源:FakeRecipeModel.cs


示例10: DoTransmute

 public virtual void DoTransmute(Mobile from, Recipe r)
 {
     if(UsesRemaining > 0)
     {
         UsesRemaining--;
     }
 }
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:7,代码来源:BaseTransmutationContainer.cs


示例11: Start

    // Use this for initialization
    void Start()
    {
        database = FindObjectOfType<ItemDatabase>();
        recipe = database.recipeCollection[0];
        TextSetup ();

        // This populates the icons for the ingredients
        for (int i = 0; i < recipe.recipeIngredients.Length; i++){
            GameObject slot = (GameObject)Instantiate(slots);
            slot.GetComponent<RecipeSlot>().slotNumber = i;
            slot.name = ("Recipe Icon " + (i+1));
            slot.transform.SetParent(this.gameObject.transform);
            slot.GetComponent<RectTransform>().localPosition = new Vector3(-145f + (45*i), -170f, 0f);
            slot.GetComponent<RectTransform>().localScale = new Vector3(1f, 1f, 1f);
        }

        // This populates the instruction lists
        for (int j = 0; j < recipe.recipeInstructions.Length; j++){
            GameObject instruction = (GameObject) Instantiate(instructions);
            Text text = instruction.GetComponent<Text>();
            text.text = recipe.recipeInstructions[j];
            instruction.name = ("Recipe Instruction " + (j+1));
            instruction.transform.SetParent(this.gameObject.transform);
            instruction.GetComponent<RectTransform>().localPosition = new Vector3(0f, -222f - (35f * j), 0f);
            instruction.GetComponent<RectTransform>().localScale = new Vector3(1f, 1f, 1f);
        }
    }
开发者ID:EpiphanyStudios,项目名称:FoodCartExpress,代码行数:28,代码来源:HomeRecipeCard.cs


示例12: PopulateKitchenPanel

	void PopulateKitchenPanel(Recipe recipe){
		GameObject newBtnPrefab = Instantiate(recipeBtnPrefab);

		switch(recipe.recipeType){
//		case Recipe.RecipeType.salad:
//			break;
		case Recipe.RecipeType.soup:
			newBtnPrefab.transform.SetParent(soupPanel, false);
			break;
		case Recipe.RecipeType.meal:
			newBtnPrefab.transform.SetParent(mealPanel, false);
			break;
		case Recipe.RecipeType.dessert:
			newBtnPrefab.transform.SetParent(dessertPanel, false);
			break;
		default:
			newBtnPrefab.transform.SetParent(saladPanel, false);

//			newBtnPrefab.transform.SetParent(basicPanel, false);
			break;
		}

		newBtnPrefab.GetComponent<RecipeBtnPrefab>().recipe = recipe;
		newBtnPrefab.GetComponentInChildren<Text>().text = recipe.recipeName;

	}
开发者ID:aimozs,项目名称:perma,代码行数:26,代码来源:KitchenManager.cs


示例13: MigrateRecipe

        private void MigrateRecipe(object sender, RoutedEventArgs e)
        {   
            // zrobić sprawdzenie czy przepis o podanej nazwie już ustnieje w bazie danych + nazwy składników!!!
            if (ForeignDbListViev.SelectedItems.Count == 1 &&
                ContainsRecipe(MainColection.ListOfRecipes, (Recipe)ForeignDbListViev.SelectedItems[0]))//!MainColection.ListOfRecipes.Contains((Recipe)ForeignDbListViev.SelectedItems[0]))//tutaj mam źle
            {
                Recipe tempRecipe = new Recipe();
                tempRecipe = (Recipe)ForeignDbListViev.SelectedItem;
                MainColection.ListOfRecipes.Add(tempRecipe);

                List<Component> componentsMigrating = new List<Component>();

                componentsMigrating.AddRange(ForeignColection.GetComponentList(tempRecipe));//get all components of chosen foreing recipe;

                MainDB.InsertData(string.Format("INSERT INTO RecipiesTable (Name,Recipe,Persons,Type)VALUES('{0}','{1}','{2}','{3}')",
                    tempRecipe.Name,
                    tempRecipe.RecipeTxt,
                    tempRecipe.Persons,
                    tempRecipe.TypeOfDish));//Insert chosen recipe into MainDB

                Recipe containerRecipe = new Recipe(MainDB.GetData(
                    string.Format("SELECT Id,Name,Recipe,Persons,Type FROM RecipiesTable WHERE Name='{0}'",
                    tempRecipe.Name)).Tables[0].Rows[0]);// Get inserted new id(for set relations in different table) and other fields of Recipe


                for (int i = 0; i < componentsMigrating.Count; ++i)
                {
                    if (ContainsComponent(MainColection.ListOfComponents, componentsMigrating[i]))    //if (!MainColection.ListOfComponents.Contains(componentsMigrating[i]))//Tutaj mam źle
                    {
                        MainDB.InsertData(string.Format("INSERT INTO ResourcesTable (Resource,Value)VALUES ('{0}','{1}')",
                           componentsMigrating[i].Name,
                           componentsMigrating[i].Value.Replace(".", ",")));// Insert Components into mainDB
                    }                                                       // if doesn't exit in mainDB
                }

                List<int> compIds = new List<int>();

                for (int i = 0; i < componentsMigrating.Count; ++i)
                {
                    compIds.Add(Convert.ToInt32(MainDB.GetData(string.Format("SELECT Idres FROM ResourcesTable WHERE Resource='{0}'",
                         componentsMigrating[i].Name)).Tables[0].Rows[0].ItemArray[0]));// get ids of components from mainDb
                }

                for (int i = 0; i < componentsMigrating.Count; ++i)
                {
                    MainDB.InsertData(string.Format("INSERT INTO RelationsTable (ComponentId,RecipeId,Amount)VALUES('{0}','{1}','{2}')",
                    compIds[i],
                    containerRecipe.Id,
                    "1"));// Set relations in mainDb
                }

                MainDbListViev.ItemsSource = null;
                MainDbListViev.ItemsSource = MainColection.ListOfRecipes;
                //pomyśleć jak to skrócić | zredukować operacje na bazie. Ale bałagan 
            }
            else
            {
                MessageBox.Show("przepis już istnieje");
            }
        }
开发者ID:leytoon,项目名称:MyPrograms,代码行数:60,代码来源:MigrationBase2Base.xaml.cs


示例14: Add

        /// <summary>
        /// Adds ingredients from recipe to shoppinglist and recipe to foodplan.
        /// </summary>
        /// <param name="recipe">Recipe to add</param>
        /// <param name="date">Date the recipe shall be added to the foodplan</param>
        public async void Add(Recipe recipe, DateTime date)
        {
            
            if (recipe?.Ingredients?.Count > 0)
            {
                if (_foodPlan.RecipeList != null)
                    foreach (var rec in _foodPlan.RecipeList)
                    {
                        if (rec.Item2.Date == date.Date)
                        {
                            _msgBoxService.ShowError("Opskrift eksisterer allerede på dato");
                            return;
                        }

                    }
                foreach (var ingredient in recipe.Ingredients)
                {
                    try
                    {
                        _shoppingListModel.AddItem(new Item() {Name = ingredient.Name});
                    }
                    catch (Exception e)
                    {
                        Log.File.Exception(e);
                        throw;
                    }
                }
            }
            _foodplanCollector.AddRecipeTupleToFoodplan(_loginModel.FoodplanId,
				new Tuple<Recipe, DateTime>(recipe, date));
            await Update();
        }
开发者ID:JakobVork,项目名称:Semesterprojekt4,代码行数:37,代码来源:FoodplanModel.cs


示例15: Add

        public int Add(string title, string preparation, int categoryId, string userId, IEnumerable<string> ingradients, IEnumerable<HttpPostedFileBase> images, string tags)
        {
            var recipeImages = this.HttpFileToRecipeImage(images);
            var recipeTags = tags.Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(t => new Tag() { Text = t }).ToList();

            var newRecipe = new Recipe()
            {
                Title = title,
                Preparation = preparation,
                Ingredients = ingradients.Select(i => new Ingredient()
                {
                    Text = i
                }).ToList(),
                Images = recipeImages,
                Tags = recipeTags,
                UserId = userId,
                CategoryId = categoryId
            };

            newRecipe.Tags.Add(new Tag() { Text = GlobalConstants.DefaultTagName });
            this.recipes.Add(newRecipe);
            this.recipes.SaveChanges();

            return newRecipe.Id;
        }
开发者ID:MystFan,项目名称:Heroically-Recipes,代码行数:26,代码来源:RecipesService.cs


示例16: Create

 public override FoodMenuInteractionDefinition<Fridge, Fridge_Have> Create(string menuText, Recipe recipe, string[] menuPath, GameObject objectClickedOn, Recipe.MealDestination destination, Recipe.MealQuantity quantity, Recipe.MealRepetition repetition, bool bWasHaveSomething, int cost)
 {
     if (cost > 0)
     {
         cost = -2147483648;
     }
     return new Definition(menuText, recipe, menuPath, objectClickedOn, destination, quantity, repetition, bWasHaveSomething, cost);
 }
开发者ID:Chain-Reaction,项目名称:NRaas,代码行数:8,代码来源:AniFridge.cs


示例17: ucSearchResult

 public ucSearchResult(Recipe recipe)
     : this()
 {
     Recipe = recipe;
     hlRecipeName.Text = recipe.Name;
     SetDescription(PrepareShortDescription(recipe));
     IsOpened = false;
 }
开发者ID:ChocolateSlayer,项目名称:CookBook,代码行数:8,代码来源:ucSearchResult.cs


示例18: CookingLessonTemplate

 public CookingLessonTemplate(RecipeSelectionMenu page, Recipe rec)
 {
     selectMenu = page;
     aRecipe = rec;
     InitializeComponent();
     lblRecipeTitle.Content = rec.Title;
     imgVidPlaceholder.Source = ImageLoader.ToWPFImage(HCI_Cooking.Properties.Resources.video_placeholder);
 }
开发者ID:kevinta893,项目名称:cpsc481,代码行数:8,代码来源:CookingLessonTemplate.xaml.cs


示例19: AllowPotion

 bool AllowPotion(Recipe newRecipe)
 {
     foreach(Recipe r in GeneratedRecipes)
     {
         if (r.CheckPotion(newRecipe.requiredIngredients) || r.potionName.Equals(newRecipe.potionName))
             return false;
     }
     return true;
 }
开发者ID:delVhar,项目名称:ToilTrouble_GGJ16,代码行数:9,代码来源:RecipeGenerator.cs


示例20: AddRecipe

        //lägger till ett recept
        public Recipe AddRecipe(string name, List<List<object>> ingredients)
        {
            if (!Regex.IsMatch(name, @"^[a-zA-Z ]+$"))
            {
                errorMessage = "Var god fyll i ett receptnamn (endast bokstäver)";
                throw new ArgumentException();
            }
            if (!ingredients.Any())
            {
                errorMessage = "Var god lägg till minst 1 ingrediens";
                throw new ArgumentException();
            }
            try
            {
                CreateMissingIngredients(ingredients);
            }
            catch (InvalidOperationException)
            {
                //felmedelandet = stack trace från createMissingIngredients();
                throw new ArgumentException();
            }

            Recipe newRecipe = new Recipe { recipeName = name };
            thDb.Recipe.Add(newRecipe);

            try
            {
                thDb.SaveChanges();
            }
            catch (DbUpdateException)
            {
                errorMessage = "Recept finns redan i databas, välj ett annat namn";
                thDb.Recipe.Remove(newRecipe);
                throw new ArgumentException();
            }

            foreach (List<object> l in ingredients)
            {
                IngredientRecipe iR = new IngredientRecipe { recipeName = name, ingredientName = (l[0] as string).ToLower(), amount = (int)l[1], unit = l[2] as string };
                try
                {
                    thDb.IngredientRecipe.Add(iR);
                    thDb.SaveChanges();
                }
                catch(DbUpdateException)
                {
                    errorMessage = "Var god gruppera ingredienserna";
                    thDb.IngredientRecipe.Remove(iR);
                    thDb.Recipe.Remove(newRecipe);
                    thDb.SaveChanges();
                    throw new ArgumentException();
                }

            }
            return newRecipe;
        }
开发者ID:submarines-and,项目名称:TacoHacker999,代码行数:57,代码来源:DataAccessLayer.cs



注:本文中的Recipe类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Record类代码示例发布时间:2022-05-24
下一篇:
C# ReceivedResponses类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap