private void FillCategories() { ProcButtonQuicks.ValidateAll(); listCategories.Items.Clear(); listCategories.Items.Add("Quick Buttons"); //hardcoded category. _listProcButtonCatDefs = Defs.GetDefsForCategory(DefCat.ProcButtonCats, true); if (_listProcButtonCatDefs.Count == 0) { selectedCat = 0; listCategories.SelectedIndex = 0; return; } for (int i = 0; i < _listProcButtonCatDefs.Count; i++) { listCategories.Items.Add(_listProcButtonCatDefs[i].ItemName); if (selectedCat == _listProcButtonCatDefs[i].DefNum) { listCategories.SelectedIndex = i + 1; } } if (listCategories.SelectedIndex == -1) //category was hidden, or just openning the form { listCategories.SelectedIndex = 0; selectedCat = 0; } if (listCategories.SelectedIndex > 0) //hardcoded category doesn't have a DefNum. { selectedCat = _listProcButtonCatDefs[listCategories.SelectedIndex - 1].DefNum; } }
private void butDelete_Click(object sender, EventArgs e) { if (IsNew) { pbqCur = null; DialogResult = DialogResult.Cancel; } else { ProcButtonQuicks.Delete(pbqCur.ProcButtonQuickNum); pbqCur = null; DialogResult = DialogResult.OK; } }
private void butOK_Click(object sender, EventArgs e) { pbqCur.Description = textDescript.Text; pbqCur.CodeValue = textProcedureCode.Text; pbqCur.Surf = textSurfaces.Text; pbqCur.IsLabel = checkIsLabel.Checked; //TODO: Validation, if we need any. if (IsNew) { ProcButtonQuicks.Insert(pbqCur); } else { ProcButtonQuicks.Update(pbqCur); } DialogResult = DialogResult.OK; }
private void fillPanelQuickButtons() { panelQuickButtons.BeginUpdate(); panelQuickButtons.ListODPanelItems.Clear(); listProcButtonQuicks = ProcButtonQuicks.GetAll(); listProcButtonQuicks.Sort(ProcButtonQuicks.sortYX); ODPanelItem pItem; for (int i = 0; i < listProcButtonQuicks.Count; i++) { pItem = new ODPanelItem(); pItem.Text = listProcButtonQuicks[i].Description; pItem.YPos = listProcButtonQuicks[i].YPos; pItem.ItemOrder = listProcButtonQuicks[i].ItemOrder; pItem.ItemType = (listProcButtonQuicks[i].IsLabel?ODPanelItemType.Label:ODPanelItemType.Button); pItem.Tags.Add(listProcButtonQuicks[i]); panelQuickButtons.ListODPanelItems.Add(pItem); } panelQuickButtons.EndUpdate(); }