public override bool TryDeleteCell(RecipeRow row) { Ingredient ingredient = row.GetOrAddIngredient(this.columnGroup); ingredient.Name = ""; return(true); }
public override void OnDataCellChanged(DataColumnChangeEventArgs e) { // grab col and change the image RecipeRow row = (RecipeRow)e.Row; string newName = e.ProposedValue == DBNull.Value || e.ProposedValue == null ? "" : (string)e.ProposedValue; Ingredient ingredient = row.GetOrAddIngredient(this.columnGroup); if (IsMaterial(newName)) { ingredient.Icon = recipesView.GetIcon(newName); } else { JsonFileData jsonFileData = (JsonFileData)ModuleDataManager.GetInstance().GetModuleFile(newName).FileData; ingredient.Icon = recipesView.GetIcon(jsonFileData); } if (newName == "") { ingredient.Amount = null; } else if (ingredient.Amount == null) { ingredient.Amount = 1; } }