private void categoryComboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (categoryComboBox1.SelectedIndex < 0) { return; } this.selected_category = (SecondStreetMaster.Category)categoryComboBox1.SelectedItem; if (SecondStreetMaster.categoryChildDictionary.ContainsKey(selected_category.id)) { //レベル2を表示 categoryComboBox2.Visible = true; categoryComboBox3.Visible = false; categoryComboBox2.Items.Clear(); foreach (var c in SecondStreetMaster.categoryChildDictionary[selected_category.id]) { categoryComboBox2.Items.Add(c); } //レベル2,3,4のindex-1に categoryComboBox2.SelectedIndex = -1; categoryComboBox3.SelectedIndex = -1; categoryComboBox2.Text = "未選択"; } else { //レベル1までしかない } }
private void ResetGUIComponent() { selected_category = new SecondStreetMaster.Category(); this.conditionNameTextBox.Text = ""; this.useBrandCheckBox.Checked = false; this.useCategoryCheckBox.Checked = false; this.categoryComboBox1.SelectedIndex = this.categoryComboBox2.SelectedIndex = this.categoryComboBox3.SelectedIndex = -1; this.categoryComboBox1.Visible = this.categoryComboBox2.Visible = this.categoryComboBox3.Visible = false; this.brandComboBox.SelectedIndex = -1; }
private void SetGUIFromSearchCondition(SearchConditionClass con) { ResetGUIComponent(); this.conditionNameTextBox.Text = con.condition_name; this.useCategoryCheckBox.Checked = con.usecategory; this.useBrandCheckBox.Checked = con.usebrand; if (con.usecategory) { if (con.category_level1 > 0) { int category_level1_selected_index = 0; foreach (var c in SecondStreetMaster.categoryChildDictionary["1"]) { if (c.id == con.category_level1.ToString()) { selected_category = c; break; } category_level1_selected_index++; } this.categoryComboBox1.SelectedIndex = category_level1_selected_index; this.categoryComboBox1.Visible = true; } if (con.category_level2 > 0) { int category_level2_selected_index = 0; foreach (var c in SecondStreetMaster.categoryChildDictionary[con.category_level1.ToString()]) { if (c.id == con.category_level2.ToString()) { selected_category = c; break; } category_level2_selected_index++; } this.categoryComboBox2.SelectedIndex = category_level2_selected_index; this.categoryComboBox2.Visible = true; } if (con.category_level3 > 0) { int category_level3_selected_index = 0; foreach (var c in SecondStreetMaster.categoryChildDictionary[con.category_level2.ToString()]) { if (c.id == con.category_level3.ToString()) { selected_category = c; break; } category_level3_selected_index++; } this.categoryComboBox3.SelectedIndex = category_level3_selected_index; this.categoryComboBox3.Visible = true; } } if (con.usebrand) { int brandcombo_index = 0; foreach (var pair in SecondStreetMaster.brandDictionary) { if (pair.Value.id == con.brand_id) { break; } brandcombo_index++; } this.brandComboBox.SelectedIndex = brandcombo_index; this.brandComboBox.Visible = true; } }