Ejemplo n.º 1
0
        private TextBox FindAmountBudgetedTextBox(CategoryMonthViewModel categoryMonth)
        {
            var masterCategory = categoryMonth.CategoryRowViewModel.MasterCategory;
            var category       = categoryMonth.CategoryRowViewModel;

            BudgetEditorMasterCategoryRow masterCategoryRow = CategoryItemsControl.ItemContainerGenerator.ContainerFromItem(masterCategory).FindChild <BudgetEditorMasterCategoryRow>();
            BudgetEditorCategoryRow       categoryRow       = masterCategoryRow.ItemContainerGenerator.ContainerFromItem(category).FindChild <BudgetEditorCategoryRow>();
            var categoryMonthControl = categoryRow.ItemContainerGenerator.ContainerFromItem(categoryMonth).FindChild <BudgetEditorCategoryMonth>();

            return(categoryMonthControl.FindName("AmountBudgetedTextbox") as TextBox);
        }
Ejemplo n.º 2
0
        private CategoryMonthViewModel FindNextCategoryMonth(BudgetEditorViewModel editorViewModel, CategoryMonthViewModel currentCategoryMonth)
        {
            var budgetMonthViewModel = currentCategoryMonth.BudgetMonthViewModel;
            int index = editorViewModel.VisibleMonthViews.IndexOf(budgetMonthViewModel);
            int count = editorViewModel.VisibleMonthViews.Count;

            int nextMonthIndex;

            if (index + 1 == count)
            {
                nextMonthIndex = 0;
            }
            else
            {
                nextMonthIndex = Math.Min(index + 1, count - 1);
            }
            BudgetMonthViewModel nextMonthViewModel = editorViewModel.VisibleMonthViews[nextMonthIndex];

            var firstMasterCategory = editorViewModel.MasterCategories.First(mc => mc.Categories.Count >= 1);
            var firstCategory       = firstMasterCategory.Categories[0];

            return(firstCategory.CategoryMonthViews.Single(cmv => cmv.BudgetMonthViewModel == nextMonthViewModel));
        }
Ejemplo n.º 3
0
        private CategoryMonthViewModel FindPreviousCategoryMonth(BudgetEditorViewModel editorViewModel, CategoryMonthViewModel currentCategoryMonth)
        {
            var budgetMonthViewModel = currentCategoryMonth.BudgetMonthViewModel;
            int index = editorViewModel.VisibleMonthViews.IndexOf(budgetMonthViewModel);
            int count = editorViewModel.VisibleMonthViews.Count;

            int nextMonthIndex;

            if (index - 1 == -1)
            {
                nextMonthIndex = count - 1;
            }
            else
            {
                nextMonthIndex = index - 1;
            }
            BudgetMonthViewModel previousMonthViewModel = editorViewModel.VisibleMonthViews[nextMonthIndex];

            var lastMasterCategory = editorViewModel.MasterCategories.Last(mc => mc.Categories.Count >= 1);
            var lastCategory       = lastMasterCategory.Categories[lastMasterCategory.Categories.Count - 1];

            return(lastCategory.CategoryMonthViews.Single(cmv => cmv.BudgetMonthViewModel == previousMonthViewModel));
        }