Пример #1
0
 public BudgetReal(BudgetReal budgetReal) : base()
 {
     foreach (BudgetRealCategory category in budgetReal.Categories)
     {
         var newCategory = new BudgetRealCategory(category);
         newCategory.PropertyChanged += OnCategoryModified;
         Categories.Add(newCategory);
     }
 }
Пример #2
0
 public void Setup(List <BudgetCategoryTemplate> categoriesDesc)
 {
     foreach (BudgetCategoryTemplate categoryDesc in categoriesDesc)
     {
         var realCategory = BudgetRealCategory.Create(categoryDesc);
         realCategory.PropertyChanged += OnCategoryModified;
         Categories.Add(realCategory);
     }
 }
Пример #3
0
        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);
        }