private void RuleForm_Load(object sender, EventArgs e) { labelInstruction.Text = Resource.FormatString("Msg_InstructionAboutAddNewRule"); AbstractCategoryManager categoryManager = RuleEngine.GetCategoryManager(); List <ICategory> categoryList = categoryManager.GetAllCategory(); categoryComboBox.Items.Clear(); foreach (ICategory category in categoryList) { categoryComboBox.Items.Add(category.GetCategoryName()); } if (m_fixedCategory != null) { categoryComboBox.SelectedItem = m_fixedCategory.GetCategoryName(); categoryComboBox.Enabled = false; } }
private void categoryComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (categoryComboBox.SelectedItem == null) { return; } string categoryName = categoryComboBox.SelectedItem as string; AbstractCategoryManager categoryManager = RuleEngine.GetCategoryManager(); ICategory category = categoryManager.GetCategory(categoryName); AbstractActionManager actionManager = RuleEngine.GetActionManager(); List <IActionDef> actionDefList = actionManager.GetPossibleActionDefList(category); actionComboBox.Items.Clear(); foreach (IActionDef actionDef in actionDefList) { actionComboBox.Items.Add(actionDef.GetActionName()); } actionComboBox.SelectedIndex = -1; CheckOKButtonEnabled(); }