public CategoryRowViewModel(MasterCategoryRowViewModel masterCategory, Category category, BudgetEditorViewModel budgetEditor) { InitializeRelayCommands(); MasterCategory = masterCategory; _category = category; _budgetEditor = budgetEditor; _categoryMonthViews = new TransformingObservableCollection <BudgetMonthViewModel, CategoryMonthViewModel>( _budgetEditor.VisibleMonthViews, v => { //BudgetMonthView holds it's own copy of the Budget and Categories so you have to match them up based on entityId //instead of ReferenceEquals on the instance BudgetMonthView view = v.BudgetMonthView; MasterCategoryMonthView masterView = view.MasterCategories.Where(mcv => mcv.MasterCategory.EntityID == category.Parent.EntityID).Single(); var categoryMonthView = masterView.Categories.Where(c => c.Category.EntityID == _category.EntityID).SingleOrDefault(); if (categoryMonthView != null) { return(new CategoryMonthViewModel(v, this, categoryMonthView)); } else { return(new CategoryMonthViewModel(v, this, masterView, _category.EntityID)); } }, cmv => { cmv.Dispose(); }); }
public MasterCategoryMonthViewModel(BudgetEditorViewModel budgetEditor, BudgetMonthViewModel budgetMonthViewModel, MasterCategoryRowViewModel masterCategoryRow, MasterCategoryMonthView masterCategoryMonthView) { _budgetEditor = budgetEditor ?? throw new ArgumentNullException(nameof(budgetEditor)); _budgetMonthViewModel = budgetMonthViewModel ?? throw new ArgumentNullException(nameof(budgetMonthViewModel)); _masterCategoryRow = masterCategoryRow ?? throw new ArgumentNullException(nameof(masterCategoryRow)); MasterCategoryMonthView = masterCategoryMonthView ?? throw new ArgumentNullException(nameof(masterCategoryMonthView)); }
public MasterCategoryMonthViewModel(BudgetEditorViewModel budgetEditor, BudgetMonthViewModel budgetMonthViewModel, MasterCategoryRowViewModel masterCategoryRow, BudgetMonthView budgetMonthView, string masterCategoryId) { _budgetEditor = budgetEditor ?? throw new ArgumentNullException(nameof(budgetEditor)); _budgetMonthViewModel = budgetMonthViewModel ?? throw new ArgumentNullException(nameof(budgetMonthViewModel)); _masterCategoryRow = masterCategoryRow ?? throw new ArgumentNullException(nameof(masterCategoryRow)); _budgetMonthView = budgetMonthView ?? throw new ArgumentNullException(nameof(budgetMonthView)); _masterCategoryId = masterCategoryId ?? throw new ArgumentNullException(nameof(masterCategoryId)); RegisterForCallback(); }
public EditMasterCategoryViewModel(MasterCategoryRowViewModel masterCategoryRow) { _masterCategoryRow = masterCategoryRow ?? throw new ArgumentNullException(nameof(masterCategoryRow)); RenameMasterCategoryCommand = new RelayCommand(RenameMasterCategory, CanRenameMasterCategory); }
public AddCategoryViewModel(MasterCategoryRowViewModel masterCategoryRow) { _masterCategoryRow = masterCategoryRow ?? throw new ArgumentNullException(nameof(masterCategoryRow)); AddCategoryCommand = new RelayCommand(AddMasterCategory, CanAddCategory); }