Exemple #1
0
        internal static void MoveSelectedItems(ShuttleTreeViewModel sourceTreeDataContext, ShuttleTreeViewModel targetTreeDataContext)
        {
            var selectedNodes = sourceTreeDataContext.SelectedTreeNodes.ToList();

            foreach (var node in selectedNodes)
            {
                RemoveItem(node, node.Parent);

                if (node.Parent == sourceTreeDataContext.TableNode)
                {
                    node.Parent = targetTreeDataContext.TableNode;
                    targetTreeDataContext.TableNode.Children.Add(node);
                }
                else if (node.Parent == sourceTreeDataContext.ViewNode)
                {
                    node.Parent = targetTreeDataContext.ViewNode;
                    targetTreeDataContext.ViewNode.Children.Add(node);
                }

                if (node.Parent.IsExpanded == false)
                {
                    node.Parent.IsExpanded = true;
                }

                node.IsSelected = false;
            }
        }
Exemple #2
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;
        }
Exemple #3
0
        internal static void MoveSelectedItems(ShuttleTreeViewModel sourceTreeDataContext, ShuttleTreeViewModel targetTreeDataContext)
        {
            var selectedNodes = sourceTreeDataContext.SelectedTreeNodes.ToList();

            foreach (var node in selectedNodes)
            {

                RemoveItem(node, node.Parent);

                if (node.Parent == sourceTreeDataContext.TableNode)
                {
                    node.Parent = targetTreeDataContext.TableNode;
                    targetTreeDataContext.TableNode.Children.Add(node);
                }
                else if (node.Parent == sourceTreeDataContext.ViewNode)
                {
                    node.Parent = targetTreeDataContext.ViewNode;
                    targetTreeDataContext.ViewNode.Children.Add(node);
                }

                if (node.Parent.IsExpanded == false)
                {
                    node.Parent.IsExpanded = true;
                }

                node.IsSelected = false;
            }
        }
        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);
        }
Exemple #5
0
        internal static void MoveAllItems(ShuttleTreeViewModel sourceTreeDataContext, ShuttleTreeViewModel targetTreeDataContext)
        {
            foreach (NodeViewModel node in sourceTreeDataContext.TableNode.Children.ToList())
            {
                RemoveItem(node, node.Parent);
                AddToNewParent(node, targetTreeDataContext.TableNode);
            }

            foreach (NodeViewModel node in sourceTreeDataContext.ViewNode.Children.ToList())
            {
                RemoveItem(node, node.Parent);
                AddToNewParent(node, targetTreeDataContext.ViewNode);
            }
        }
Exemple #6
0
        internal static void MoveAllItems(ShuttleTreeViewModel sourceTreeDataContext, ShuttleTreeViewModel targetTreeDataContext)
        {
            foreach (NodeViewModel node in sourceTreeDataContext.TableNode.Children.ToList())
            {
                RemoveItem(node, node.Parent);
                AddToNewParent(node, targetTreeDataContext.TableNode);
            }

            foreach (NodeViewModel node in sourceTreeDataContext.ViewNode.Children.ToList())
            {
                RemoveItem(node, node.Parent);
                AddToNewParent(node, targetTreeDataContext.ViewNode);
            }
        }
Exemple #7
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;
        }
        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);
        }
 public MainPage()
 {
     InitializeComponent();
     this.sourceTree.DataContext = SourceTreeDataContext = this.GetSourceTreeModel();
     this.targetTree.DataContext = TargetTreeDataContext = this.GetTargetTreeModel();
 }