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

            ConfirmActionMethod camConfirm = (ConfirmActionMethod)p_objArgs[0];

            foreach (IMod modMod in m_lstModList)
            {
                OverallMessage = "Installing selected mods: " + modMod.ModName;

                if (m_iilInstallLog.ActiveMods.Contains(modMod))
                {
                    continue;
                }

                ModInstaller minInstaller = m_mifModInstallerFactory.CreateInstaller(modMod, m_dlgOverwriteConfirmationDelegate, null);
                minInstaller.Install();

                while (!minInstaller.IsCompleted)
                {
                }
                if (OverallProgress < OverallProgressMaximum)
                {
                    StepOverallProgress();
                }
            }
            return(null);
        }
Beispiel #2
0
        private bool InstallMods(object[] args)
        {
            int modCounter = 0;

            if (_modsToInstall != null && _modsToInstall.Count > 0)
            {
                modCounter = _modsToInstall.Count;
            }

            OverallMessage          = string.Format("Profile Switch Setup: Installing selected mods ({0})...", modCounter);
            OverallProgress         = 0;
            OverallProgressStepSize = 1;
            OverallProgressMaximum  = _modsToInstall.Count;
            ShowItemProgress        = false;

            ConfirmActionMethod camConfirm = (ConfirmActionMethod)args[0];

            if (_profileToInstall != null && _profileManager != null)
            {
                _profileManager.SetCurrentProfile(_profileToInstall);
            }


            foreach (IMod modMod in _modsToInstall)
            {
                OverallMessage = "Profile Switch Setup: Installing selected mods: " + modMod.ModName;

                if (_installLog.ActiveMods.Contains(modMod))
                {
                    continue;
                }

                ModInstaller minInstaller = _modInstallerFactory.CreateInstaller(modMod, _overwriteConfirmationDelegate, null);
                minInstaller.Install();

                while (!minInstaller.IsCompleted)
                {
                }
                if (OverallProgress < OverallProgressMaximum)
                {
                    StepOverallProgress();
                }
            }

            if (_profileToSwitch != null && _profileManager != null)
            {
                _profileManager.SetCurrentProfile(_profileToSwitch);
            }

            return(true);
        }