private void ComboBoxType_SelectedIndexChanged(object sender, EventArgs e) { ConsumbleCategorieCore.GetConsumbleCategorie(ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxType.SelectedItem.ToString()).ToString()); try { comboBoxCategory.DataSource = ConsumbleCategorieCore.consumbleCategories.ToList(); comboBoxCategory.SelectedIndex = 0; } catch { comboBoxConsumbles.DataSource = null; comboBoxCategory.Text = ""; buttonOk.Enabled = false; } }
private void comboBoxType_SelectionChangeCommitted(object sender, EventArgs e) { if (comboBoxCategory.Items != null) { comboBoxCategory.Items.Clear(); } ConsumbleCategorieCore.GetConsumbleCategorie(ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxType.SelectedItem.ToString()).ToString()); if (ConsumbleCategorieCore.consumbleCategories.items.Count > 0) { foreach (string category in ConsumbleCategorieCore.consumbleCategories.ToList()) { comboBoxCategory.Items.Add(category); } comboBoxCategory.SelectedIndex = 0; } else { comboBoxCategory.Text = ""; comboBoxCategory.Enabled = false; } this.Refresh(); }
public void DownloadConsumbleCategories() { bool isOk = true; long typeID = -1; try { typeID = ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxConsumbleTypes.SelectedItem.ToString()); } catch { isOk = false; ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_TYPE_BEFORE); } if (isOk) { new Thread(() => { ConsumbleCategorieCore.GetConsumbleCategorie(typeID.ToString()); UpdateDataGridView(typeID); }).Start(); } }