Пример #1
0
        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;
        }
Пример #2
0
        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);
        }
Пример #3
0
		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);
				}
			}
		}
Пример #4
0
        ///<summary>This is not currently being used.</summary>
        public static void Delete(ToolButItem Cur)
        {
            string command = "DELETE from toolbutitem WHERE ToolButItemNum = '"
                             + POut.PInt(Cur.ToolButItemNum) + "'";

            General.NonQ(command);
        }
Пример #5
0
        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;
        }
Пример #6
0
        ///<summary>This in not currently being used.</summary>
        public static void Update(ToolButItem Cur)
        {
            string command = "UPDATE toolbutitem SET "
                             + "ProgramNum ='" + POut.PInt(Cur.ProgramNum) + "'"
                             + ",ToolBar ='" + POut.PInt((int)Cur.ToolBar) + "'"
                             + ",ButtonText ='" + POut.PString(Cur.ButtonText) + "'"
                             + " WHERE ToolButItemNum = '" + POut.PInt(Cur.ToolButItemNum) + "'";

            General.NonQ(command);
        }
Пример #7
0
        ///<summary></summary>
        public static void Insert(ToolButItem Cur)
        {
            string command = "INSERT INTO toolbutitem (ProgramNum,ToolBar,ButtonText) "
                             + "VALUES ("
                             + "'" + POut.PInt(Cur.ProgramNum) + "', "
                             + "'" + POut.PInt((int)Cur.ToolBar) + "', "
                             + "'" + POut.PString(Cur.ButtonText) + "')";

            General.NonQ(command);
        }
Пример #8
0
        ///<summary></summary>
        public static void Refresh()
        {
            string command =
                "SELECT * from toolbutitem";
            DataTable table = General.GetTable(command);;

            List = new ToolButItem[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i] = new ToolButItem();
                List[i].ToolButItemNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].ProgramNum     = PIn.PInt(table.Rows[i][1].ToString());
                List[i].ToolBar        = (ToolBarsAvail)PIn.PInt(table.Rows[i][2].ToString());
                List[i].ButtonText     = PIn.PString(table.Rows[i][3].ToString());
            }
        }
Пример #9
0
 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;
 }