public override void AddNewSubcat(BudgetSubcatEdit subcat) { var newSubcat = RealSubcat.Create(subcat.Name, subcat.Id); newSubcat.PropertyChanged += OnSubcatChanged; subcats.Add(newSubcat); }
public static RealSubcat Create(string subcatName, int id) { var subcat = new RealSubcat { Name = subcatName, Id = id }; for (int i = 0; i < 31; i++) { var subcatVal = new SubcatValue(i) { Value = 0 }; subcatVal.PropertyChanged += subcat.OnValueChanged; subcat.Values.Add(subcatVal); } return(subcat); }
public static BudgetRealCategory Create(BudgetCategoryTemplate categoryDesc) { var category = new BudgetRealCategory() { Name = categoryDesc.Name, Id = categoryDesc.Id, IsIncome = categoryDesc.IsIncome, IconName = categoryDesc.IconFileName }; int index = 0; foreach (string subcatName in categoryDesc.subcategories) { var subcat = RealSubcat.Create(subcatName, index++); subcat.PropertyChanged += category.OnSubcatChanged; category.subcats.Add(subcat); } return(category); }