/// <summary>
        /// The method that is called to start the backgound task.
        /// </summary>
        /// <param name="args">Arguments to for the task execution.</param>
        /// <returns>Always <c>null</c>.</returns>
        protected override object DoWork(object[] args)
        {
            OverallMessage          = "Deleting all the selected mods...";
            OverallProgress         = 0;
            OverallProgressStepSize = 1;
            OverallProgressMaximum  = m_rolModList.Count;
            ShowItemProgress        = false;

            ConfirmActionMethod camConfirm = (ConfirmActionMethod)args[0];

            foreach (IMod modMod in m_rolModList)
            {
                OverallMessage = "Deleting: " + modMod.ModName;

                ModDeleter mddDeleter = InstallerFactory.CreateDelete(modMod, ActiveMods);
                mddDeleter.TaskSetCompleted += new EventHandler <TaskSetCompletedEventArgs>(Deactivator_TaskSetCompleted);
                mddDeleter.Install();
                DeleteXMLInstalledFile(modMod);

                if (OverallProgress < OverallProgressMaximum)
                {
                    StepOverallProgress();
                }

                if (m_booCancel)
                {
                    break;
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes the given mod.
        /// </summary>
        /// <remarks>
        /// The mod is deactivated, unregistered, and then deleted.
        /// </remarks>
        /// <param name="p_modMod">The mod to delete.</param>
        /// <param name="p_rolActiveMods">The list of active mods.</param>
        /// <returns>A background task set allowing the caller to track the progress of the operation,
        /// or <c>null</c> if no long-running operation needs to be done.</returns>
        public IBackgroundTaskSet DeleteMod(IMod p_modMod, ReadOnlyObservableList <IMod> p_rolActiveMods)
        {
            ModDeleter mddDeleter = InstallerFactory.CreateDelete(p_modMod, p_rolActiveMods);

            mddDeleter.TaskSetCompleted += new EventHandler <TaskSetCompletedEventArgs>(Deactivator_TaskSetCompleted);
            mddDeleter.Install();
            return(mddDeleter);
        }