public override void AddNewSubcat(BudgetSubcatEdit subcat)
        {
            var newSubcat = PlannedSubcat.Create(subcat.Name, subcat.Id);

            newSubcat.PropertyChanged += OnSubcatChanged;
            subcats.Add(newSubcat);
        }
Beispiel #2
0
        public static PlannedSubcat Create(string subcatName, int id)
        {
            var subcat = new PlannedSubcat
            {
                Name = subcatName,
                Id   = id
            };

            return(subcat);
        }
        public static BudgetPlannedCategory Create(BudgetCategoryTemplate categoryDesc)
        {
            var category = new BudgetPlannedCategory()
            {
                Name     = categoryDesc.Name,
                Id       = categoryDesc.Id,
                IsIncome = categoryDesc.IsIncome,
                IconName = categoryDesc.IconFileName
            };

            int index = 0;

            foreach (string subcatName in categoryDesc.subcategories)
            {
                var subcat = PlannedSubcat.Create(subcatName, index++);
                subcat.PropertyChanged += category.OnSubcatChanged;
                category.subcats.Add(subcat);
            }

            return(category);
        }