private void InstallComponent(int index, Pipes.StreamString pipeStream) { pipeStream.WriteString("[Component]" + components[index].Name); // Subscribe to the ProgressUpdate event, and update the installer pages' progress bar components[index].ProgressUpdate += delegate(object sender, ProgressUpdateEventArgs e) { pipeStream.WriteString("[Progress]" + e.Percent); }; components[index].StatusUpdate += delegate(object sender, StatusUpdateEventArgs e) { pipeStream.WriteString("[Status]" + e.Status); }; components[index].InstallComplete += delegate(object sender, EventArgs e) { if (index + 1 < components.Count) { InstallComponent(index + 1, pipeStream); } else { if (InstallComplete != null) InstallComplete(this, EventArgs.Empty); } }; switch (Mode) { case InstallMode.Install: { components[index].Install(); } break; case InstallMode.Repair: { components[index].Repair(destinationDirectory); } break; } }