protected List <ITreeViewItem> GetChildrentGeneric <T>(RepositoryFolder <T> RF, string OrderBy) { List <ITreeViewItem> Childrens = new List <ITreeViewItem>(); ObservableList <RepositoryFolder <T> > subFolders = RF.GetSubFolders(); foreach (RepositoryFolder <T> envFolder in subFolders) { Childrens.Add(GetTreeItem(envFolder)); } subFolders.CollectionChanged -= TreeFolderItems_CollectionChanged; // track sub folders subFolders.CollectionChanged += TreeFolderItems_CollectionChanged; // track sub folders //Add direct childrens ObservableList <T> folderItems = RF.GetFolderItems(); // why we need -? in case we did refresh and reloaded the item TODO: research, make children called once folderItems.CollectionChanged -= TreeFolderItems_CollectionChanged; folderItems.CollectionChanged += TreeFolderItems_CollectionChanged;//adding event handler to add/remove tree items automatically based on folder items collection changes foreach (T item in folderItems.OrderBy(OrderBy)) { ITreeViewItem tvi = GetTreeItem(item); Childrens.Add(tvi); } return(Childrens); }
List <ITreeViewItem> ITreeViewItem.Childrens() { List <ITreeViewItem> Childrens = new List <ITreeViewItem>(); ObservableList <RepositoryFolder <ApplicationPOMModel> > subFolders = mPOMModelFolder.GetSubFolders(); foreach (RepositoryFolder <ApplicationPOMModel> pomFolder in subFolders) { ApplicationPOMsTreeItem pomFTVI = new ApplicationPOMsTreeItem(pomFolder); Childrens.Add(pomFTVI); } subFolders.CollectionChanged -= TreeFolderItems_CollectionChanged; // untrack sub folders subFolders.CollectionChanged += TreeFolderItems_CollectionChanged; // track sub folders //Add direct childrens mChildPoms = mPOMModelFolder.GetFolderItems(); mChildPoms.CollectionChanged -= TreeFolderItems_CollectionChanged; mChildPoms.CollectionChanged += TreeFolderItems_CollectionChanged;//adding event handler to add/remove tree items automatically based on folder items collection changes foreach (ApplicationPOMModel pom in mChildPoms.OrderBy(nameof(ApplicationPOMModel.Name))) { ApplicationPOMTreeItem pomTI = new ApplicationPOMTreeItem(pom); Childrens.Add(pomTI); } return(Childrens); }
List <ITreeViewItem> ITreeViewItem.Childrens() { List <ITreeViewItem> Childrens = new List <ITreeViewItem>(); ObservableList <RepositoryFolder <ApplicationAPIModel> > subFolders = mAPIModelFolder.GetSubFolders(); foreach (RepositoryFolder <ApplicationAPIModel> apiFolder in subFolders) { AppApiModelsFolderTreeItem apiFTVI = new AppApiModelsFolderTreeItem(apiFolder, mShowEditInMenu); Childrens.Add(apiFTVI); } subFolders.CollectionChanged -= TreeFolderItems_CollectionChanged; // untrack sub folders subFolders.CollectionChanged += TreeFolderItems_CollectionChanged; // track sub folders //Add direct children's mChildAPIs = mAPIModelFolder.GetFolderItems(); mChildAPIs.CollectionChanged -= TreeFolderItems_CollectionChanged; mChildAPIs.CollectionChanged += TreeFolderItems_CollectionChanged;//adding event handler to add/remove tree items automatically based on folder items collection changes foreach (ApplicationAPIModel api in mChildAPIs.OrderBy(nameof(ApplicationAPIModel.Name))) { AppApiModelTreeItem apiTI = new AppApiModelTreeItem(api, mShowEditInMenu); Childrens.Add(apiTI); } return(Childrens); }
private void AddBftoSubFolderButton_Click(object sender, RoutedEventArgs e) { RepositoryFolder <BusinessFlow> root = mSolutionRepository.GetRepositoryItemRootFolder <BusinessFlow>(); RepositoryFolder <BusinessFlow> subfolder = root.GetSubFolders()[0]; BusinessFlow BF = new BusinessFlow("BFSF BF " + DateTime.Now); subfolder.AddRepositoryItem(BF); }
private void AddsubFolders(RepositoryFolder <BusinessFlow> mRepositoryFolder, List <ITreeViewItem> Childrens) { try { foreach (RepositoryFolder <BusinessFlow> f in mRepositoryFolder.GetSubFolders()) { BusinessFlowsFolderTreeItem BFFTI = new BusinessFlowsFolderTreeItem(f, mViewMode); Childrens.Add(BFFTI); } } catch (System.Exception excpt) { Console.WriteLine(excpt.Message); } }
List <ITreeViewItem> ITreeViewItem.Childrens() { List <ITreeViewItem> Childrens = new List <ITreeViewItem>(); foreach (RepositoryFolder <ApplicationPOMModel> POMFolder in mPOMModelFolder.GetSubFolders()) { ApplicationPOMsTreeItem apiFTVI = new ApplicationPOMsTreeItem(POMFolder); Childrens.Add(apiFTVI); } //Add direct childrens foreach (ApplicationPOMModel api in mPOMModelFolder.GetFolderItems()) { ApplicationPOMTreeItem apiTI = new ApplicationPOMTreeItem(api); Childrens.Add(apiTI); } return(Childrens); }