Example #1
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);
				}
			}
		}
 private void FormChartProcedureEntryEdit_Load(object sender, System.EventArgs e)
 {
     AutoCodes.RefreshCache();
     ProcButtonItems.RefreshCache();
     if (IsNew)
     {
         this.Text = Lan.g(this, "Add Procedure Button");
     }
     else
     {
         this.Text = Lan.g(this, "Edit Procedure Button");
     }
     textDescript.Text      = ProcButtonCur.Description;
     _listProcButtonCatDefs = Defs.GetDefsForCategory(DefCat.ProcButtonCats, true);
     for (int i = 0; i < _listProcButtonCatDefs.Count; i++)
     {
         comboCategory.Items.Add(_listProcButtonCatDefs[i].ItemName);
         if (ProcButtonCur.Category == _listProcButtonCatDefs[i].DefNum)
         {
             comboCategory.SelectedIndex = i;
         }
     }
     if (comboCategory.SelectedIndex == -1)
     {
         comboCategory.SelectedIndex = 0;              //we know that there will always be at least one cat. Validated in FormProcButtons
     }
     pictureBox.Image        = PIn.Bitmap(ProcButtonCur.ButtonImage);
     checkMultiVisit.Checked = ProcButtonCur.IsMultiVisit;
     long[] codeNumList = ProcButtonItems.GetCodeNumListForButton(ProcButtonCur.ProcButtonNum);
     long[] auto        = ProcButtonItems.GetAutoListForButton(ProcButtonCur.ProcButtonNum);
     listADA.Items.Clear();
     for (int i = 0; i < codeNumList.Length; i++)
     {
         listADA.Items.Add(ProcedureCodes.GetStringProcCode(codeNumList[i]));
     }
     listAutoCodes.Items.Clear();
     _listShortDeep = AutoCodes.GetListDeep(true);
     for (int i = 0; i < _listShortDeep.Count; i++)
     {
         listAutoCodes.Items.Add(_listShortDeep[i].Description);
         for (int j = 0; j < auto.Length; j++)
         {
             if (auto[j] == _listShortDeep[i].AutoCodeNum)
             {
                 listAutoCodes.SetSelected(i, true);
                 break;
             }
         }
     }
     //fill images to pick from
     for (int i = 0; i < imageList.Images.Count; i++)
     {
         listView.Items.Add("", i);
     }
 }
Example #3
0
        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 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();
        }
Example #5
0
        private void FillButtons()
        {
            listViewButtons.Items.Clear();
            imageListProcButtons.Images.Clear();
            if (selectedCat == 0)
            {
                ButtonList = new ProcButton[0];
                return;
            }
            ProcButtons.RefreshCache();
            ButtonList = ProcButtons.GetForCat(selectedCat);
            //first check and fix any order problems
            for (int i = 0; i < ButtonList.Length; i++)
            {
                if (ButtonList[i].ItemOrder != i)
                {
                    ButtonList[i].ItemOrder = i;
                    ProcButtons.Update(ButtonList[i]);
                }
            }
            ListViewItem item;

            for (int i = 0; i < ButtonList.Length; i++)
            {
                if (ButtonList[i].ButtonImage != "")
                {
                    //image keys are simply the ProcButtonNum
                    try {
                        imageListProcButtons.Images.Add(ButtonList[i].ProcButtonNum.ToString(), PIn.Bitmap(ButtonList[i].ButtonImage));
                    }
                    catch {
                        imageListProcButtons.Images.Add(new Bitmap(20, 20));                       //Add a blank image so the list stays in synch
                    }
                }
                item = new ListViewItem(new string[] { ButtonList[i].Description }, ButtonList[i].ProcButtonNum.ToString());
                listViewButtons.Items.Add(item);
            }
        }
Example #6
0
        ///<summary>Set phone and triage flag to display. Get/Set accessor won't work here because we require 2 seperate fields in order to update the control properly.</summary>
        public void SetPhone(Phone phone, PhoneEmpDefault phoneEmpDefault, bool isTriageOperator)
        {
            phoneCur = phone;
            if (phoneCur == null)            //empty out everything and return
            {
                this.Visible            = false;
                pictureWebCam.Image     = null;          //or just make it not visible?
                pictureInUse.Visible    = false;
                labelExtensionName.Text = "";
                labelStatusAndNote.Text = "";
                labelTime.Text          = "";
                labelTime.BackColor     = this.BackColor;
                labelCustomer.Text      = "";
                return;
            }
            this.Visible = true;
            if (ShowImageForced)
            {
                pictureWebCam.Image   = PIn.Bitmap(phoneCur.WebCamImage);
                pictureWebCam.Visible = true;
            }
            else if (phoneCur.ClockStatus == ClockStatusEnum.Home ||
                     phoneCur.ClockStatus == ClockStatusEnum.None ||
                     phoneCur.ClockStatus == ClockStatusEnum.Off)
            {
                pictureWebCam.Image   = null;
                pictureWebCam.Visible = false;
            }
            else if (phoneCur.ClockStatus == ClockStatusEnum.Break ||
                     phoneCur.ClockStatus == ClockStatusEnum.Lunch)
            {
                pictureWebCam.Visible = true;
                Bitmap   bmp = new Bitmap(pictureWebCam.Width, pictureWebCam.Height);
                Graphics g   = Graphics.FromImage(bmp);
                try {
                    g.FillRectangle(SystemBrushes.Control, 0, 0, bmp.Width, bmp.Height);
                    string strStat = phoneCur.ClockStatus.ToString();
                    SizeF  sizef   = g.MeasureString(strStat, labelStatusAndNote.Font);
                    g.DrawString(strStat, labelStatusAndNote.Font, SystemBrushes.GrayText, (bmp.Width - sizef.Width) / 2, (bmp.Height - sizef.Height) / 2);
                    pictureWebCam.Image = (Image)bmp.Clone();
                }
                finally {
                    g.Dispose();
                    g = null;
                    bmp.Dispose();
                    bmp = null;
                }
            }
            else
            {
                pictureWebCam.Visible = true;
                pictureWebCam.Image   = PIn.Bitmap(phoneCur.WebCamImage);
            }
            if (phoneCur.Description == "")
            {
                pictureInUse.Visible = false;
            }
            else
            {
                pictureInUse.Visible = true;
            }
            labelExtensionName.Text = "";
            string str = phoneCur.ClockStatus.ToString();

            //Check if the user is logged in.
            if (phoneCur.ClockStatus == ClockStatusEnum.None ||
                phoneCur.ClockStatus == ClockStatusEnum.Home)
            {
                str = "Clock In";
            }
            //Always show ext and name, no matter if user is clocked in or not. This keeps phone tiles from appearing blank with no extension and name.
            string nameStr = "Vacant";

            if (phoneCur.EmployeeName != "")
            {
                nameStr = phoneCur.EmployeeName;
            }
            labelExtensionName.Text = phoneCur.Extension.ToString() + " - " + nameStr;
            labelStatusAndNote.Text = str;
            DateTime dateTimeStart = phoneCur.DateTimeStart;

            if (dateTimeStart.Date == DateTime.Today)
            {
                TimeSpan span      = DateTime.Now - dateTimeStart + TimeDelta;
                DateTime timeOfDay = DateTime.Today + span;
                labelTime.Text = timeOfDay.ToString("H:mm:ss");
            }
            else
            {
                labelTime.Text = "";
            }
            if (phoneCur.ClockStatus == ClockStatusEnum.Home ||
                phoneCur.ClockStatus == ClockStatusEnum.None ||
                phoneCur.ClockStatus == ClockStatusEnum.Break)
            {
                labelTime.BackColor = this.BackColor;              //No color if employee is not currently working.
            }
            else
            {
                Color outerColor;
                Color innerColor;
                Color fontColor;
                bool  isTriageOperatorOnTheClock = false;
                //get the cubicle color and triage status
                Phones.GetPhoneColor(phone, phoneEmpDefault, false, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
                if (!timerFlash.Enabled)                  //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
                {
                    labelTime.BackColor = outerColor;
                }
                if (phoneCur.ClockStatus == ClockStatusEnum.NeedsHelp)
                {
                    if (!timerFlash.Enabled)                      //Only start the flash timer and color the control once. This prevents over-flashing effect.
                    {
                        labelTime.Tag = new object[2] {
                            false, labelTime.BackColor
                        };
                        timerFlash.Start();
                    }
                }
            }
            if (phoneCur.ClockStatus == ClockStatusEnum.Home ||
                phoneCur.ClockStatus == ClockStatusEnum.None)
            {
                labelTime.BorderStyle = System.Windows.Forms.BorderStyle.None;              //Remove color box if employee is not currently working.
            }
            else
            {
                labelTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            }
            if (phoneCur.ClockStatus != ClockStatusEnum.NeedsHelp)            //Always assume the flash timer was previously turned on and turn it off here. No harm if it' already off.
            {
                timerFlash.Stop();
            }
            labelCustomer.Text = phoneCur.CustomerNumber;
        }
Example #7
0
        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);
                }
            }
        }