private void butOK_Click(object sender, System.EventArgs e) { ProgramCur.ProgName = textProgName.Text; ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; ProgramCur.Path = textPath.Text; ProgramCur.CommandLine = textCommandLine.Text; ProgramCur.Note = textNote.Text; if (IsNew) { Programs.Insert(ProgramCur); } else { Programs.Update(ProgramCur); } ToolButItems.DeleteAllForProgram(ProgramCur.ProgramNum); //then add one toolButItem for each highlighted row in listbox ToolButItem ToolButItemCur; for (int i = 0; i < listToolBars.SelectedIndices.Count; i++) { ToolButItemCur = new ToolButItem(); ToolButItemCur.ProgramNum = ProgramCur.ProgramNum; ToolButItemCur.ButtonText = textButtonText.Text; ToolButItemCur.ToolBar = (ToolBarsAvail)listToolBars.SelectedIndices[i]; ToolButItems.Insert(ToolButItemCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (checkEnabled.Checked && textPluginDllName.Text != "") { string dllPath = ODFileUtils.CombinePaths(Application.StartupPath, textPluginDllName.Text); if (dllPath.Contains("[VersionMajMin]")) { Version vers = new Version(Application.ProductVersion); dllPath = dllPath.Replace("[VersionMajMin]", ""); //now stripped clean } if (!File.Exists(dllPath)) { MessageBox.Show(Lan.g(this, "Dll file not found:") + " " + dllPath); return; } } if (textPluginDllName.Text != "" && textPath.Text != "") { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "If both a path and a plug-in are specified, the path will be ignored. Continue anyway?")) { return; } } ProgramCur.ProgName = textProgName.Text; ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; ProgramCur.Path = textPath.Text; if (pathOverrideOld != textOverride.Text) { ProgramProperties.InsertOrUpdateLocalOverridePath(ProgramCur.ProgramNum, textOverride.Text); ProgramProperties.RefreshCache(); } ProgramCur.CommandLine = textCommandLine.Text; ProgramCur.PluginDllName = textPluginDllName.Text; ProgramCur.Note = textNote.Text; ProgramCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png); if (IsNew) { Programs.Insert(ProgramCur); } else { Programs.Update(ProgramCur); } ToolButItems.DeleteAllForProgram(ProgramCur.ProgramNum); //then add one toolButItem for each highlighted row in listbox ToolButItem ToolButItemCur; for (int i = 0; i < listToolBars.SelectedIndices.Count; i++) { ToolButItemCur = new ToolButItem(); ToolButItemCur.ProgramNum = ProgramCur.ProgramNum; ToolButItemCur.ButtonText = textButtonText.Text; ToolButItemCur.ToolBar = (ToolBarsAvail)listToolBars.SelectedIndices[i]; ToolButItems.Insert(ToolButItemCur); } DialogResult = DialogResult.OK; }