private void FillForm() { //this is not refined enough to be called more than once on the form because it will not //remember the toolbars that were selected. ToolButItems.Refresh(); ProgramProperties.Refresh(); textProgName.Text = ProgramCur.ProgName; textProgDesc.Text = ProgramCur.ProgDesc; checkEnabled.Checked = ProgramCur.Enabled; textPath.Text = ProgramCur.Path; textCommandLine.Text = ProgramCur.CommandLine; textNote.Text = ProgramCur.Note; ToolButItems.GetForProgram(ProgramCur.ProgramNum); listToolBars.Items.Clear(); for (int i = 0; i < Enum.GetNames(typeof(ToolBarsAvail)).Length; i++) { listToolBars.Items.Add(Enum.GetNames(typeof(ToolBarsAvail))[i]); } for (int i = 0; i < ToolButItems.ForProgram.Count; i++) { listToolBars.SetSelected((int)((ToolButItem)ToolButItems.ForProgram[i]).ToolBar, true); } if (ToolButItems.ForProgram.Count > 0) //the text on all buttons will be the same for now { textButtonText.Text = ((ToolButItem)ToolButItems.ForProgram[0]).ButtonText; } ProgramPropertiesForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum); listProperties.Items.Clear(); for (int i = 0; i < ProgramPropertiesForProgram.Count; i++) { listProperties.Items.Add(((ProgramProperty)ProgramPropertiesForProgram[i]).PropertyDesc + ": " + ((ProgramProperty)ProgramPropertiesForProgram[i]).PropertyValue); } }
///<summary>This can only be called by the user if it is a program link that they created. Included program links cannot be deleted. If calling this from ClassConversion, must delete any dependent ProgramProperties first. It will delete ToolButItems for you.</summary> public static void Delete(Program Cur) { ToolButItems.DeleteAllForProgram(Cur.ProgramNum); string command = "DELETE from program WHERE programnum = '" + Cur.ProgramNum.ToString() + "'"; General.NonQ(command); }
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 SaveProgram() { SaveClinicCurProgramPropertiesToDict(); _progCur.Enabled = checkEnabled.Checked; _progCur.Path = textPath.Text; _progCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png); ToolButItems.DeleteAllForProgram(_progCur.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() { ProgramNum = _progCur.ProgramNum, ButtonText = textButtonText.Text, ToolBar = (ToolBarsAvail)listToolBars.SelectedIndices[i] }; ToolButItems.Insert(toolButItemCur); } if (_pathOverrideOld != textOverride.Text) //If there was no previous override _pathOverrideOld will be empty string. { _hasProgramPropertyChanged = true; ProgramProperties.InsertOrUpdateLocalOverridePath(_progCur.ProgramNum, textOverride.Text); } UpdateProgramProperty(_patNumOrChartNum, POut.Bool(radioChart.Checked)); //Will need to be enhanced if another radio button ever gets added. UpdateProgramProperty(_infoFilePath, textInfoFile.Text); UpsertProgramPropertiesForClinics(); Programs.Update(_progCur); }
public static void LoadToolbar(ODToolBar ToolBarMain,ToolBarsAvail toolBarsAvail) { List<ToolButItem> toolButItems=ToolButItems.GetForToolBar(toolBarsAvail); for(int i=0;i<toolButItems.Count;i++) { ToolButItem toolButItemCur=((ToolButItem)toolButItems[i]); Program programCur=Programs.GetProgram(toolButItemCur.ProgramNum); string key=programCur.ProgramNum.ToString()+programCur.ProgName.ToString(); if(ToolBarMain.ImageList.Images.ContainsKey(key)) { //Dispose the existing image only if it already exists, because the image might have changed. ToolBarMain.ImageList.Images[ToolBarMain.ImageList.Images.IndexOfKey(key)].Dispose(); ToolBarMain.ImageList.Images.RemoveByKey(key); } if(programCur.ButtonImage!="") { Image image=PIn.Bitmap(programCur.ButtonImage); ToolBarMain.ImageList.Images.Add(key,image); } if(toolBarsAvail!=ToolBarsAvail.MainToolbar) { ToolBarMain.Buttons.Add(new ODToolBarButton(ODToolBarButtonStyle.Separator)); } ToolBarMain.Buttons.Add(new ODToolBarButton(toolButItemCur.ButtonText,-1,"",programCur)); } for(int i=0;i<ToolBarMain.Buttons.Count;i++) {//Reset the new index, because it might have changed due to removing/adding to the Images list. if(ToolBarMain.Buttons[i].Tag.GetType()!=typeof(Program)) { continue; } Program programCur=(Program)ToolBarMain.Buttons[i].Tag; string key=programCur.ProgramNum.ToString()+programCur.ProgName.ToString(); if(ToolBarMain.ImageList.Images.ContainsKey(key)) { ToolBarMain.Buttons[i].ImageIndex=ToolBarMain.ImageList.Images.IndexOfKey(key); } } }
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; }
private void FillForm() { //ComboClinic is filled in the load method if (PIn.Int(_patNumOrChartNum.PropertyValue) == 1) { radioChart.Checked = true; } else { radioPatient.Checked = true; } List <ToolButItem> listToolButItems = ToolButItems.GetForProgram(_progCur.ProgramNum); listToolBars.Items.Clear(); for (int i = 0; i < Enum.GetNames(typeof(ToolBarsAvail)).Length; i++) { listToolBars.Items.Add(Enum.GetNames(typeof(ToolBarsAvail))[i]); } for (int i = 0; i < listToolButItems.Count; i++) { listToolBars.SetSelected((int)listToolButItems[i].ToolBar, true); } checkEnabled.Checked = _progCur.Enabled; textPath.Text = _progCur.Path; textButtonText.Text = listToolButItems[0].ButtonText; pictureBox.Image = PIn.Bitmap(_progCur.ButtonImage); try { textInfoFile.Text = _infoFilePath.PropertyValue; _pathOverrideOld = ProgramProperties.GetLocalPathOverrideForProgram(_progCur.ProgramNum); textOverride.Text = _pathOverrideOld; if (_dictLocationIDs.ContainsKey(_clinicNumCur)) { textLocationID.Text = _dictLocationIDs[_clinicNumCur].PropertyValue; } } catch (Exception) { MsgBox.Show(this, "You are missing a program property from the database. Please call support to resolve this issue."); DialogResult = DialogResult.Cancel; return; } }
private void butOK_Click(object sender, EventArgs e) { //Program _prog.Enabled = checkEnable.Checked; _prog.ProgDesc = textProgDesc.Text; _prog.Path = textPath.Text; Programs.Update(_prog); //Toolbar button ToolButItems.DeleteAllForProgram(_prog.ProgramNum); foreach (ToolBarsAvail toolbar in listToolBars.SelectedItems) { ToolButItem newBut = new ToolButItem(); newBut.ProgramNum = _prog.ProgramNum; newBut.ToolBar = toolbar; newBut.ButtonText = textButText.Text; ToolButItems.Insert(newBut); } //Update settings as necessary UpdateBencoSettings(); MsgBox.Show(this, "You will need to restart Open Dental for these changes to take effect."); DialogResult = DialogResult.OK; }
private void FillForm() { //this is not refined enough to be called more than once on the form because it will not //remember the toolbars that were selected. ToolButItems.RefreshCache(); ProgramProperties.RefreshCache(); textProgName.Text = ProgramCur.ProgName; textProgDesc.Text = ProgramCur.ProgDesc; checkEnabled.Checked = ProgramCur.Enabled; textPath.Text = ProgramCur.Path; textCommandLine.Text = ProgramCur.CommandLine; textPluginDllName.Text = ProgramCur.PluginDllName; textNote.Text = ProgramCur.Note; pictureBox.Image = PIn.Bitmap(ProgramCur.ButtonImage); List <ToolButItem> itemsForProgram = ToolButItems.GetForProgram(ProgramCur.ProgramNum); listToolBars.Items.Clear(); for (int i = 0; i < Enum.GetNames(typeof(ToolBarsAvail)).Length; i++) { listToolBars.Items.Add(Enum.GetNames(typeof(ToolBarsAvail))[i]); } for (int i = 0; i < itemsForProgram.Count; i++) { listToolBars.SetSelected((int)itemsForProgram[i].ToolBar, true); } if (!AllowToolbarChanges) //As we add more static bridges, we will need to enhance this to show/hide controls as needed. { listToolBars.ClearSelected(); listToolBars.Enabled = false; } if (itemsForProgram.Count > 0) //the text on all buttons will be the same for now { textButtonText.Text = itemsForProgram[0].ButtonText; } FillGrid(); }
public FormBencoSetup() { InitializeComponent(); _prog = Programs.GetCur(ProgramName.BencoPracticeManagement); _listToolButs = ToolButItems.GetForProgram(_prog.ProgramNum); //Only set up for Main Toolbar }
public static void LoadToolbar(ODToolBar ToolBarMain, ToolBarsAvail toolBarsAvail) { List <ToolButItem> toolButItems = ToolButItems.GetForToolBar(toolBarsAvail); foreach (ToolButItem toolButItemCur in toolButItems) { Program programCur = Programs.GetProgram(toolButItemCur.ProgramNum); if (PrefC.HasClinicsEnabled) { //User should not have PL hidden if Clinics are not Enabled, otherwise this could create a situation where users may turn clinics off but //have hidden the PL button for HQ and then be unable to turn the button back on without re-enabling Clinics. ProgramProperty programProp = ProgramProperties.GetPropForProgByDesc(programCur.ProgramNum , ProgramProperties.PropertyDescs.ClinicHideButton, Clinics.ClinicNum); if (programProp != null) { continue; //If there exists a programProp for a clinic which should have its buttons hidden, carry on and do not display the button. } } if (ProgramProperties.IsAdvertisingDisabled(programCur)) { continue; } string key = programCur.ProgramNum.ToString() + programCur.ProgName.ToString(); if (ToolBarMain.ImageList.Images.ContainsKey(key)) { //Dispose the existing image only if it already exists, because the image might have changed. ToolBarMain.ImageList.Images[ToolBarMain.ImageList.Images.IndexOfKey(key)].Dispose(); ToolBarMain.ImageList.Images.RemoveByKey(key); } if (programCur.ButtonImage != "") { Image image = PIn.Bitmap(programCur.ButtonImage); ToolBarMain.ImageList.Images.Add(key, image); } else if (programCur.ProgName == ProgramName.Midway.ToString()) { Image image = global::OpenDental.Properties.Resources.Midway_Icon_22x22; ToolBarMain.ImageList.Images.Add(key, image); } if (toolBarsAvail != ToolBarsAvail.MainToolbar) { ToolBarMain.Buttons.Add(new ODToolBarButton(ODToolBarButtonStyle.Separator)); } ODToolBarButton button = new ODToolBarButton(toolButItemCur.ButtonText, -1, "", programCur); AddDropDown(button, programCur); ToolBarMain.Buttons.Add(button); } for (int i = 0; i < ToolBarMain.Buttons.Count; i++) //Reset the new index, because it might have changed due to removing/adding to the Images list. { if (ToolBarMain.Buttons[i].Tag.GetType() != typeof(Program)) { continue; } Program programCur = (Program)ToolBarMain.Buttons[i].Tag; string key = programCur.ProgramNum.ToString() + programCur.ProgName.ToString(); if (ToolBarMain.ImageList.Images.ContainsKey(key)) { ToolBarMain.Buttons[i].ImageIndex = ToolBarMain.ImageList.Images.IndexOfKey(key); } } }