private void olvTrSettings_CellEditStarting(object sender, BrightIdeasSoftware.CellEditEventArgs e) { int idx = olvTrSettings.SelectedIndex; TriggerTypeOption option = (e.RowObject as TriggerTypeEntry).Option; if (option.List != null) { ComboBox cmb = new ComboBox(); cmb.FlatStyle = FlatStyle.Flat; cmb.DropDownStyle = ComboBoxStyle.DropDownList; cmb.Sorted = option is TriggerTypeOptionAIObject; if (option is TriggerTypeOptionAIObject) { cmb.Items.Add(noneTeam); } foreach (object item in option.List) { cmb.Items.Add(item); } cmb.SelectedItem = e.Value; cmb.Bounds = e.CellBounds; e.Control = cmb; } }
private void olvTrSettings_CellEditFinishing(object sender, BrightIdeasSoftware.CellEditEventArgs e) { int idx = olvTrSettings.SelectedIndex; TriggerTypeOption option = (e.RowObject as TriggerTypeEntry).Option; if (option.List != null) { e.NewValue = (e.Control as ComboBox).SelectedItem; } }
private Dictionary <string, TriggerTypeOption> LoadTriggerTypeOptions(IniDictionary config) { Dictionary <string, TriggerTypeOption> options = new Dictionary <string, TriggerTypeOption>(); OrderedDictionary section = config["TriggerTypeOptions"]; int sortOrder = 0; foreach (DictionaryEntry entry in section) { string[] split = (entry.Value as string).Split(','); string key = split[0]; string name = split[1]; string type = split[2]; TriggerTypeOption option = null; if (type.CompareTo("SIDE") == 0) { option = new TriggerTypeOptionList(name, sortOrder, sides); } else if (type.CompareTo("HOUSE") == 0) { option = new TriggerTypeOptionStringList(name, sortOrder, triggerHouseTypes); } else if (type.CompareTo("TECHNOTYPE") == 0) { option = new TriggerTypeOptionTechno(name, sortOrder, technoTypes); } else if (type.CompareTo("TEAM") == 0) { option = new TriggerTypeOptionAIObject(name, sortOrder, teamTypes.Items); } else if (type.CompareTo("CONDITION") == 0) { option = new TriggerTypeOptionList(name, sortOrder, conditionTypes); } else if (type.CompareTo("OPERATOR") == 0) { option = new TriggerTypeOptionList(name, sortOrder, operatorTypes); } else if (type.CompareTo("BOOL") == 0) { option = new TriggerTypeOptionBool(name, sortOrder); } else { option = new TriggerTypeOptionNumber(name, sortOrder); } options.Add(key, option); sortOrder++; } return(options); }
public TriggerTypeEntry(TriggerTypeEntry other) { this.option = other.option; this.Value = other.Value; }
public TriggerTypeEntry(TriggerTypeOption option, object value) { this.option = option; this.Value = value; }