/// <summary> /// Processes a set of actions, running them in a multi-threaded way based on the application's settings. /// </summary> /// <param name="theList">An ItemList to be processed.</param> /// <param name="showUI">Whether or not we should display a UI to inform the user about progress.</param> public void DoActions(ItemList theList, bool showUI) { logger.Info("**********************"); logger.Info("Doing Selected Actions...."); if (theList == null) { return; } // Run tasks in parallel (as much as is sensible) ActionQueue[] queues = this.ActionProcessorMakeQueues(theList); this.ActionPause = false; // If not /hide, show CopyMoveProgress dialog CopyMoveProgress cmp = null; if (showUI) { cmp = new CopyMoveProgress(this, queues); } this.ActionProcessorThread = new Thread(this.ActionProcessor) { Name = "ActionProcessorThread" }; this.ActionProcessorThread.Start(queues); if ((cmp != null) && (cmp.ShowDialog() == DialogResult.Cancel)) { this.ActionProcessorThread.Abort(); } this.ActionProcessorThread.Join(); theList.RemoveAll(x => (x is Action) && ((Action)x).Done && !((Action)x).Error); foreach (Item sli in theList) { if (sli is Action) { Action slia = (Action)sli; logger.Warn("Failed to complete the following action: {0}, doing {1}. Error was {2}", slia.Name, slia.ToString(), slia.ErrorText); } } logger.Info("Completed Selected Actions"); logger.Info("**************************"); }