/// <summary> /// Returns whether the specified binded control information already exists within the collection or not. /// </summary> /// <param name="control">Development.Materia.Database.BindedControl to evaluate.</param> /// <returns>True if the specified Development.Materia.Database.BindedControl already exists within the collection otherwise false.</returns> public bool Contains(BindedControl control) { return List.Contains(control); }
/// <summary> /// Removes the specified binded control information from the collection. /// </summary> /// <param name="control">Development.Materia.Database.BindedControl to remove</param> public void Remove(BindedControl control) { if (Contains(control)) { if (_controltable.ContainsKey(control.Control)) _controltable.Remove(control.Control); if (_fieldtable.ContainsKey(control.FieldName)) _fieldtable.Remove(control.FieldName); List.Remove(control); } }
/// <summary> /// Adds a new binded control information into the collection. /// </summary> /// <param name="control">Binded control object</param> /// <param name="field">Database field name to bind into the control</param> /// <returns>Newly added Development.Materia.Database.BindedControl</returns> public BindedControl Add(object control, string field) { if (!String.IsNullOrEmpty(field.RLTrim())) { BindedControl _control = new BindedControl(this, control, field); if (Contains(control)) Remove(control); int _index = List.Add(_control); if (!_controltable.ContainsKey(control)) _controltable.Add(control, (BindedControl)List[_index]); if (!_fieldtable.ContainsKey(field)) _fieldtable.Add(field, (BindedControl)List[_index]); return (BindedControl)List[_index]; } else return null; }