/// <summary> /// Builds the installer with the specified index, in a thread-safe way, so that /// several installers can be built concurrently. /// </summary> /// <param name="i">The index into the list of installer names</param> private void ThreadSafeCreateInstaller(int i) { var installerGenerator = new InstallerGenerator(m_installerInfo); var names = m_installerInfo.GetNamesArray(); ThreadSafeAddSummaryText("Starting to build " + names[i] + " installer...", false); var report = names[i] + ": "; report += installerGenerator.CreateInstaller(i); ThreadSafeAddSummaryText(report, false); }
/// <summary> /// Entry point for new thread that performs the installer build(s). /// </summary> void LaunchBuild() { // Disable the button that launched the build: ThreadSafeEnableControls(false); if (m_selectedInstallerIndex == -1) { ThreadSafeAddSummaryText("Building all installers concurrently...", true); Parallel.For(0, ComponentNamesBox.Items.Count - 1, ThreadSafeCreateInstaller); } else { ThreadSafeAddSummaryText("Working...", true); var installerGenerator = new InstallerGenerator(m_installerInfo); var status = installerGenerator.CreateInstaller(m_selectedInstallerIndex); ThreadSafeAddSummaryText(status, false); } ThreadSafeAddSummaryText("Finished!", false); // Re-enable the launch button: ThreadSafeEnableControls(true); }