private void add_ToolStripButton_Click(object sender, EventArgs e) { this.Focus(); if (_dataContext != null && _package != null) { //System.Diagnostics.Debug.WriteLine(_package.ToString()); if (_package.PackageId == Guid.Empty) { MessageBox.Show("Unable to add an installer to the selected package.", "Invalid Package", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } using (SoftwareInstallersForm installersForm = new SoftwareInstallersForm(_dataContext)) { if (installersForm.ShowDialog(this) == DialogResult.OK) { SoftwareInstaller installer = installersForm.Selected; SoftwareInstallerSetting setting = _dataContext.CreateObject <SoftwareInstallerSetting>(); setting.InstallerId = installer.InstallerId; setting.PackageId = _package.PackageId; setting.InstallOrderNumber = _package.SoftwareInstallerSettings.Count + 1; setting.SoftwareInstaller = installer; _settings.Add(new InstallerSettingRow(setting)); _package.SoftwareInstallerSettings.Add(setting); _dataContext.AddToSoftwareInstallerSettings(setting); } } } }