コード例 #1
0
        private void FillButtons()
        {
            listViewButtons.Items.Clear();
            imageListProcButtons.Images.Clear();
            if (selectedCat == 0)
            {
                ButtonList = new ProcButton[0];
                return;
            }
            ProcButtons.Refresh();
            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 != null)
                {
                    //image keys are simply the ProcButtonNum
                    imageListProcButtons.Images.Add(ButtonList[i].ProcButtonNum.ToString(), ButtonList[i].ButtonImage);
                }
                item = new ListViewItem(new string[] { ButtonList[i].Description }, ButtonList[i].ProcButtonNum.ToString());
                listViewButtons.Items.Add(item);
            }
        }
コード例 #2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDescript.Text == "")
            {
                MessageBox.Show(Lan.g(this, "You must type in a description."));
                return;
            }
            if (listADA.Items.Count == 0 && listAutoCodes.SelectedIndices.Count == 0)
            {
                MessageBox.Show(Lan.g(this, "You must pick at least one Auto Code or Procedure Code."));
                return;
            }
            ProcButtonCur.Description = textDescript.Text;
            if (ProcButtonCur.Category != _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum)
            {
                //This will put it at the end of the order in the new category
                ProcButtonCur.ItemOrder
                    = ProcButtons.GetForCat(_listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum).Length;
            }
            ProcButtonCur.Category    = _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum;
            ProcButtonCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png);
            if (IsNew)
            {
                ProcButtonCur.ItemOrder = ProcButtons.GetCount();
                ProcButtons.Insert(ProcButtonCur);
            }
            else
            {
                ProcButtons.Update(ProcButtonCur);
            }
            ProcButtonItems.DeleteAllForButton(ProcButtonCur.ProcButtonNum);
            ProcButtonItem item;

            for (int i = 0; i < listADA.Items.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.CodeNum       = ProcedureCodes.GetCodeNum(listADA.Items[i].ToString());
                item.ItemOrder     = i + 1;        //not i++, that would mess up the itteration.
                ProcButtonItems.Insert(item);
            }
            for (int i = 0; i < listAutoCodes.SelectedIndices.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.AutoCodeNum   = _listShortDeep[listAutoCodes.SelectedIndices[i]].AutoCodeNum;
                item.ItemOrder     = i + 1;        //not i++, that would mess up the itteration.
                ProcButtonItems.Insert(item);
            }
            DialogResult = DialogResult.OK;
        }
コード例 #3
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDescript.Text == "")
            {
                MessageBox.Show(Lan.g(this, "You must type in a description."));
                return;
            }
            if (listADA.Items.Count == 0 && listAutoCodes.SelectedIndices.Count == 0)
            {
                MessageBox.Show(Lan.g(this, "You must pick at least one Auto Code or ADA Code."));
                return;
            }
            ProcButtonCur.Description = textDescript.Text;
            if (ProcButtonCur.Category != DefB.Short[(int)DefCat.ProcButtonCats][comboCategory.SelectedIndex].DefNum)
            {
                //This will put it at the end of the order in the new category
                ProcButtonCur.ItemOrder
                    = ProcButtons.GetForCat(DefB.Short[(int)DefCat.ProcButtonCats][comboCategory.SelectedIndex].DefNum).Length;
            }
            ProcButtonCur.Category    = DefB.Short[(int)DefCat.ProcButtonCats][comboCategory.SelectedIndex].DefNum;
            ProcButtonCur.ButtonImage = (Bitmap)pictureBox.Image;
            if (IsNew)
            {
                ProcButtonCur.ItemOrder = ProcButtons.List.Length;
                ProcButtons.Insert(ProcButtonCur);
            }
            else
            {
                ProcButtons.Update(ProcButtonCur);
            }
            ProcButtonItems.DeleteAllForButton(ProcButtonCur.ProcButtonNum);
            ProcButtonItem item;

            for (int i = 0; i < listADA.Items.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.ADACode       = listADA.Items[i].ToString();
                ProcButtonItems.Insert(item);
            }
            for (int i = 0; i < listAutoCodes.SelectedIndices.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.AutoCodeNum   = AutoCodes.ListShort[listAutoCodes.SelectedIndices[i]].AutoCodeNum;
                ProcButtonItems.Insert(item);
            }
            DialogResult = DialogResult.OK;
        }
コード例 #4
0
        private void FillButtons()
        {
            listViewButtons.Items.Clear();
            imageListProcButtons.Images.Clear();
            if (selectedCat == 0)
            {
                //empty button list and return because we will be using and OD grid to display these buttons.
                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);
            }
        }
コード例 #5
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDescript.Text == "")
            {
                MessageBox.Show(Lan.g(this, "You must type in a description."));
                return;
            }
            if (listADA.Items.Count == 0 && listAutoCodes.SelectedIndices.Count == 0)
            {
                MessageBox.Show(Lan.g(this, "You must pick at least one Auto Code or Procedure Code."));
                return;
            }
            foreach (int index in listAutoCodes.SelectedIndices)
            {
                AutoCode autoCode = _listShortDeep[index];
                if (AutoCodeItems.GetListForCode(autoCode.AutoCodeNum).Count == 0)
                {
                    //This AutoCode was saved with no AutoCodeItems attached, which is invalid.
                    MessageBox.Show(this, Lan.g(this, "The following AutoCode has no associated Procedure Codes: ") + "\r\n" + autoCode.Description + "\r\n"
                                    + Lan.g(this, "AutoCode must be setup correctly before it can be used with a Quick Proc Button."));
                    return;
                }
            }
            //Point of no return.
            ProcButtonCur.Description = textDescript.Text;
            if (ProcButtonCur.Category != _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum)
            {
                //This will put it at the end of the order in the new category
                ProcButtonCur.ItemOrder
                    = ProcButtons.GetForCat(_listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum).Length;
            }
            ProcButtonCur.Category     = _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum;
            ProcButtonCur.ButtonImage  = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png);
            ProcButtonCur.IsMultiVisit = checkMultiVisit.Checked;
            if (IsNew)
            {
                ProcButtonCur.ItemOrder = ProcButtons.GetCount();
                ProcButtons.Insert(ProcButtonCur);
            }
            else
            {
                ProcButtons.Update(ProcButtonCur);
            }
            ProcButtonItems.DeleteAllForButton(ProcButtonCur.ProcButtonNum);
            ProcButtonItem item;

            for (int i = 0; i < listADA.Items.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.CodeNum       = ProcedureCodes.GetCodeNum(listADA.Items[i].ToString());
                item.ItemOrder     = i + 1;        //not i++, that would mess up the itteration.
                ProcButtonItems.Insert(item);
            }
            for (int i = 0; i < listAutoCodes.SelectedIndices.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.AutoCodeNum   = _listShortDeep[listAutoCodes.SelectedIndices[i]].AutoCodeNum;
                item.ItemOrder     = i + 1;        //not i++, that would mess up the itteration.
                ProcButtonItems.Insert(item);
            }
            DialogResult = DialogResult.OK;
        }