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);
                Childrens.Add(apiFTVI);
            }
            subFolders.CollectionChanged -= TreeFolderItems_CollectionChanged; // untrack sub folders
            subFolders.CollectionChanged += TreeFolderItems_CollectionChanged; // track sub folders

            //Add direct childrens
            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);
                Childrens.Add(apiTI);
            }

            return(Childrens);
        }
        public override bool PasteCopiedTreeItem(object nodeItemToCopy, TreeViewItemGenericBase targetFolderNode, bool toRefreshFolder = true)
        {
            RepositoryItemBase copiedItem = CopyTreeItemWithNewName((RepositoryItemBase)nodeItemToCopy);

            if (copiedItem != null)
            {
                AppApiModelTreeItem.HandleGlobalModelParameters(nodeItemToCopy, copiedItem);            // avoid generating new GUIDs for Global Model Parameters associated to API Model being copied
                ((RepositoryFolderBase)(((ITreeViewItem)targetFolderNode).NodeObject())).AddRepositoryItem(copiedItem);
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
 public void AddActionToListHandler(object sender, RoutedEventArgs e)
 {
     if (mAPIPage.xTreeView.Tree.CurrentSelectedTreeViewItem != null)
     {
         GingerWPF.TreeViewItemsLib.ApplicationModelsTreeItems.AppApiModelTreeItem selectedItem = mAPIPage.xTreeView.Tree.CurrentSelectedTreeViewItem as GingerWPF.TreeViewItemsLib.ApplicationModelsTreeItems.AppApiModelTreeItem;
         if (selectedItem != null)
         {
             BusinessFlowPages.ActionsFactory.AddActionsHandler(selectedItem.mApiModel, mContext);
         }
     }
 }