Exemple #1
0
 public GroupHeaderByCategory(string categoryGlobalId)
 {
     Category = CategoriesDal.GetCategoryByGlobalId(categoryGlobalId) ?? new Category {
         Name     = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("uncategorized"),
         Id       = -1,
         ColorKey = "12",
         IconKey  = "FontIcon_19"
     };
 }
Exemple #2
0
        private async void TypeOfOperationRadioButton_Checked(object sender, RoutedEventArgs e)
        {
            RaisePropertyChanged(nameof(AccountsComboBox));

            if (CategoryValue.SelectedIndex != -1)
            {
                string idOfSelectedCategory    = ((ComboBoxItem)CategoryValue.SelectedItem).Tag.ToString();
                string idOfSelectedSubCategory = string.Empty;

                if (SubCategoryValue.SelectedIndex != -1)
                {
                    idOfSelectedSubCategory = ((ComboBoxItem)SubCategoryValue.SelectedItem).Tag.ToString();
                }

                await SetCategoryComboBoxItems((bool)Expense_RadioButton.IsChecked, (bool)Income_RadioButton.IsChecked);

                if (CategoryValue.Items.OfType <ComboBoxItem>().Any(i => i.Tag.ToString() == idOfSelectedCategory))
                {
                    CategoryValue.SelectedItem = CategoryValue.Items.OfType <ComboBoxItem>().Single(i => i.Tag.ToString() == idOfSelectedCategory);
                }

                else
                {
                    SubCategoryValue.IsEnabled = false;
                }

                if (!string.IsNullOrEmpty(idOfSelectedSubCategory))
                {
                    if (SubCategoryValue.Items.OfType <SubCategory>().Any(i => i.GlobalId == idOfSelectedSubCategory))
                    {
                        Category subCatItem = CategoriesDal.GetCategoryByGlobalId(idOfSelectedSubCategory);
                        SubCategoryValue.SelectedItem = SubCategoryValue.Items.OfType <ComboBoxItem>().Single(ri => ri.Content.ToString() == subCatItem.Name);
                    }
                }
            }

            else
            {
                await SetCategoryComboBoxItems((bool)Expense_RadioButton.IsChecked, (bool)Income_RadioButton.IsChecked);

                SubCategoryValue.IsEnabled = false;
            }

            SetPrimaryButtonEnabling();
        }