protected override void ExecuteCore()
        {
            Folder targetFolder = GetTargetNodeAncestorAsXenObjectOrGroupingTag <Folder>();

            if (DraggedNodes != null)
            {
                foreach (VirtualTreeNode draggedNode in DraggedNodes)
                {
                    if (GetItemsNotAlreadyInTargetFolder().Contains((IXenObject)draggedNode.Tag))
                    {
                        GreyAll(draggedNode);
                    }
                }
            }

            new MoveToFolderAction(GetItemsNotAlreadyInTargetFolder(), targetFolder).RunAsync();

            // need to now wait until the operation has finished... then we can expand the node.
            ThreadPool.QueueUserWorkItem(delegate
            {
                for (int i = 0; i < 20 && TargetNode.Nodes.Count == 0; i++)
                {
                    Thread.Sleep(100);
                }

                MainWindowCommandInterface.Invoke(delegate { TargetNode.Expand(); });
            });
        }
Exemplo n.º 2
0
        protected override void ExecuteCore()
        {
            Folder             targetFolder = GetTargetNodeAncestorAsXenObjectOrGroupingTag <Folder>();
            List <AsyncAction> actions      = new List <AsyncAction>();

            foreach (IXenObject draggedItem in GetItemsNotAlreadyInTargetFolder())
            {
                actions.Add(new FolderAction(draggedItem, targetFolder, FolderAction.Kind.Move));
            }

            if (DraggedNodes != null)
            {
                foreach (VirtualTreeNode draggedNode in DraggedNodes)
                {
                    if (GetItemsNotAlreadyInTargetFolder().Contains((IXenObject)draggedNode.Tag))
                    {
                        GreyAll(draggedNode);
                    }
                }
            }

            MultipleActionLauncher launcher = new MultipleActionLauncher(actions, string.Format(Messages.MOVE_OBJECTS_TO_FOLDER, targetFolder.Name), Messages.MOVING, Messages.MOVED, true);

            launcher.Run();

            // need to now wait until the operation has finished... then we can expand the node.
            ThreadPool.QueueUserWorkItem(delegate
            {
                for (int i = 0; i < 20 && TargetNode.Nodes.Count == 0; i++)
                {
                    Thread.Sleep(100);
                }

                MainWindowCommandInterface.Invoke(delegate { TargetNode.Expand(); });
            });
        }