Ejemplo n.º 1
0
        private ShuttleTreeViewModel GetSourceTreeModel()
        {
            ShuttleTreeViewModel sourceTreeModel = new ShuttleTreeViewModel();

            NodeViewModel metadataParentNode = new NodeViewModel("Metadata", null, false, true, "../../Images/Computer.png", false);
            NodeViewModel dbo = new NodeViewModel("dbo", metadataParentNode, false, true, "../../Images/Drive.png", false);
            metadataParentNode.Children.Add(dbo);

            sourceTreeModel.TableNode = new NodeViewModel("Tables", dbo, false, true, "../../Images/Folder.png", false);
            sourceTreeModel.ViewNode = new NodeViewModel("Views", dbo, false, true, "../../Images/Folder.png", false);

            dbo.Children.Add(sourceTreeModel.TableNode);
            dbo.Children.Add(sourceTreeModel.ViewNode);

            for (int i = 0; i < 15; i++)
            {
                NodeViewModel currentTableFolderNode = new NodeViewModel("Item " + i, sourceTreeModel.TableNode, false, true, "../../Images/File.png");
                sourceTreeModel.TableNode.Children.Add(currentTableFolderNode);
            }

            for (int i = 0; i < 15; i++)
            {
                NodeViewModel currentViewFolderNode = new NodeViewModel("Item " + i, sourceTreeModel.ViewNode, false, true, "../../Images/File.png");
                sourceTreeModel.ViewNode.Children.Add(currentViewFolderNode);
            }
            sourceTreeModel.TreeViewData.Add(metadataParentNode);
            return sourceTreeModel;
        }
Ejemplo n.º 2
0
        private static void AddToNewParent(NodeViewModel node, NodeViewModel parent)
        {
            node.Parent = parent;
            parent.Children.Add(node);

            if (parent.IsExpanded == false)
            {
                parent.IsExpanded = true;
            }
        }
Ejemplo n.º 3
0
 public NodeViewModel(string header, NodeViewModel parent, bool isSelected, bool isExpanded, string imagePath, bool isSelectable = true)
 {
     this.Header = header;
     this.Parent = parent;
     this.IsSelected = isSelected;
     this.IsExpanded = isExpanded;
     this.ImagePath = imagePath;
     this.Children = new ObservableCollection<NodeViewModel>();
     this.IsSelectable = isSelectable;
 }
Ejemplo n.º 4
0
        private ShuttleTreeViewModel GetTargetTreeModel()
        {
            ShuttleTreeViewModel sourceTreeModel = new ShuttleTreeViewModel();

            NodeViewModel selectedObjects = new NodeViewModel("Selected Objects", null, false, true, "../../Images/Computer.png", false);
            NodeViewModel dbo = new NodeViewModel("dbo", selectedObjects, false, true, "../../Images/Drive.png", false);
            sourceTreeModel.TableNode = new NodeViewModel("Tables", dbo, false, true, "../../Images/Folder.png", false);
            sourceTreeModel.ViewNode = new NodeViewModel("Views", dbo, false, true, "../../Images/Folder.png", false);
            selectedObjects.Children.Add(dbo);
            dbo.Children.Add(sourceTreeModel.TableNode);
            dbo.Children.Add(sourceTreeModel.ViewNode);

            sourceTreeModel.TreeViewData.Add(selectedObjects);
            return sourceTreeModel;
        }
Ejemplo n.º 5
0
 private static void RemoveItem(NodeViewModel nodeToRemove, NodeViewModel parentNode)
 {
     parentNode.Children.Remove(nodeToRemove);
 }