Beispiel #1
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(); });
            });
        }
Beispiel #2
0
        /// <summary>
        /// Runs the specified <see cref="AsyncAction"/>s such that they are synchronous per connection but asynchronous across connections.
        /// </summary>
        public void RunMultipleActions(IEnumerable <AsyncAction> actions, string title, string startDescription, string endDescription, bool runActionsInParallel)
        {
            MultipleActionLauncher launcher = new MultipleActionLauncher(actions, title, startDescription, endDescription, runActionsInParallel);

            launcher.Run();
        }