private async void DoFindTemplateRecipe(RecipeItem item) { var ingredientTable = mEditRecipeParams.CreateDictionary(); if (ingredientTable.ContainsKey(item?.ItemId ?? string.Empty)) { Inform($"{item.Text} has already been found. You can reset it by clicking the {btnReset.Text} button."); return; } var task = Task.Run(() => RecipeItemParser.Run(item, mEditRecipeParams.TemplateRecipes)); var delay = Task.Delay(TimeSpan.FromSeconds(1)); var completed = await Task.WhenAny(delay, task); if (completed == delay) { splashScreenManager1.ShowWaitForm(); await task; splashScreenManager1.CloseWaitForm(); } var result = task.Result; if (result.Success) { using (var dlg = new RecipeItemParseResultsWizard(mEditRecipeParams.IngredientAdder, result)) { if (dlg.ShowDialog(this) == DialogResult.OK) { dlg.Commit(); gridViewItems.RefreshData(); } } } else { var input = result.SearchText ?? item.Text; Inform($"Unable to find '{input}' in the base recipes", "Failed to Find"); } }
public RecipeItemListItem(RecipeItem item) => Item = item;
public RecipeItemParseResult(RecipeItem item) { Item = item; }