private void GetArgsAndInitComboBoxes() { BindingDef def = null; foreach (ComboBox cb in _comboxes.Keys) { def = _comboxes[cb]; cb.Items.Clear(); Dictionary <IAction, PropertyInfo[]> atts = _bindingEnvironment.QueryCompatibleProperty(_action, def.BindingAttribute, def.PropertyInfo); if (atts != null && atts.Count > 0) { foreach (IAction act in atts.Keys) { PropertyInfo[] ps = atts[act]; if (ps == null || ps.Length == 0) { continue; } foreach (PropertyInfo p in ps) { BindingAttribute ba = ArgBindingHelper.GetBingdingAttribute(p.Name, act); BindingScriptObject script = new BindingScriptObject(act, ba, p, def.PropertyInfo); cb.Items.Add(script); } } } } }
private void InitExistBindingPair(ComboBox cb, PropertyInfo p, BindingPair[] pairs) { foreach (BindingPair pir in pairs) { if (pir.PropertyInfo.Equals(p)) { if (pir.PropertyValue is PropertyValueByValue) { object txt = (pir.PropertyValue as PropertyValueByValue).Value; if (txt != null) { cb.Text = txt.ToString(); } } else if (pir.PropertyValue is PropertyValueByVar) { cb.Text = (pir.PropertyValue as PropertyValueByVar).VarValue; } else if (pir.PropertyValue is PropertyValueByRef) { PropertyValueByRef refv = pir.PropertyValue as PropertyValueByRef; BindingScriptObject obj = new BindingScriptObject(refv.RefAction, refv.RefBindingAttribute, refv.RefPropertyInfo, p); cb.Items.Add(obj); cb.SelectedIndex = cb.Items.Count - 1; } break; } } }