private void PerformViewModelSetup() { DataFormDesignTemplate = new DataFormDesignTemplate(); DataFormEntries = new ObservableCollection <DataFormEntry>(); NewItemTypes = new ObservableCollection <Type>(); NewItemTypes.Add(typeof(DataFormListEntry)); AddDataFormEntryCommand = new RelayCommand(AddDataFormEntryCommandExecute, CanAddDataFormEntryCommandExecute); RemoveDataFormEntryCommand = new RelayCommand(RemoveDataFormEntryExecute, CanRemoveDataFormEntryExecute); RowNumberGeneratorCommand = new RelayCommand(RowNumberGeneratorExecute, CanRowNumberGeneratorExecute); PropertyCommand = new RelayCommand(PropertyCommandExecute, CanPropertyCommandExecute); GenerateDataFormCommand = new RelayCommand(GenerateDataFormCommandExecute, CanGenerateDataFormCommand); SaveToCloudCommand = new RelayCommand(SaveToCloudCommandExecute, CanSaveToCloudCommandExecute); SaveToLocalCommand = new RelayCommand(SaveToLocalCommandExecute, CanSaveToLocalCommandExecute); AddFormTypeCommand = new RelayCommand(AddFormTypeCommandExecute, CanAddFormTypeCommandExecute); UpdateFormTypeCommand = new RelayCommand(UpdateFormTypeCommandExecute, CanUpdateFormTypeCommandExecute); RemoveFormTypeCommand = new RelayCommand(RemoveFormTypeCommandExecute, CanRemoveFormTypeCommandExecute); AddCategoryCommand = new RelayCommand(AddCategoryCommandExecute, CanAddCategoryCommandExecute); UpdateCategoryCommand = new RelayCommand(UpdateCategoryCommandExecute, CanUpdateCategoryCommandExecute); RemoveCategoryCommand = new RelayCommand(RemoveCategoryCommandExecute, CanRemoveCategoryCommandExecute); AddSubCategoryCommand = new RelayCommand(AddSubCategoryCommandExecute, CanAddSubCategoryCommandExecute); UpdateSubCategoryCommand = new RelayCommand(UpdateSubCategoryCommandExecute, CanUpdateSubCategoryCommandExecute); RemoveSubCategoryCommand = new RelayCommand(RemoveSubCategoryCommandExecute, CanRemoveSubCategoryCommandExecute); LoadDataFormTypes(); LoadDataFormCategories(); if (CurrentCategorySelection == null) { CurrentCategorySelection = DataFormCategories[0]; CurrentSubCategorySelection = DataFormSubCategories.Where(x => x.CategoryId == CurrentCategorySelection.CategoryId).FirstOrDefault(); } if (CurrentDataFormTypeSelection == null) { CurrentDataFormTypeSelection = DataFormTypes[0]; } }
private void LoadDataFormSubCategories(long categorId) { if (DataFormSubCategories == null) { var subCategories = dataFormRepository.GetSynchronizationRegistries(); DataFormSubCategories = new ObservableCollection <DataFormSubCategory>(); } DataFormSubCategories.Clear(); DataFormSubCategories.Add(new DataFormSubCategory() { CategoryId = 1, SubCategoryId = 1, SubCategoryName = "Credit Cards", Description = "Credit Cards" }); DataFormSubCategories.Add(new DataFormSubCategory() { CategoryId = 1, SubCategoryId = 2, SubCategoryName = "Bank Accounts", Description = "Bank Accounts" }); DataFormSubCategories.Add(new DataFormSubCategory() { CategoryId = 1, SubCategoryId = 3, SubCategoryName = "Web Accounts", Description = "Web Accounts" }); DataFormSubCategories.Add(new DataFormSubCategory() { CategoryId = 2, SubCategoryId = 1, SubCategoryName = "Access Control", Description = "Access" }); var temp = DataFormSubCategories.Where(category => category.CategoryId == categorId).OrderBy(z => z.SubCategoryName); DataFormSubCategories = new ObservableCollection <DataFormSubCategory>(temp); }