Exemplo n.º 1
0
        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();
            });
        }
Exemplo n.º 2
0
 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));
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
0
        public EditMasterCategoryViewModel(MasterCategoryRowViewModel masterCategoryRow)
        {
            _masterCategoryRow = masterCategoryRow ?? throw new ArgumentNullException(nameof(masterCategoryRow));

            RenameMasterCategoryCommand = new RelayCommand(RenameMasterCategory, CanRenameMasterCategory);
        }
Exemplo n.º 5
0
        public AddCategoryViewModel(MasterCategoryRowViewModel masterCategoryRow)
        {
            _masterCategoryRow = masterCategoryRow ?? throw new ArgumentNullException(nameof(masterCategoryRow));

            AddCategoryCommand = new RelayCommand(AddMasterCategory, CanAddCategory);
        }