private static List <BindingSourceNode> GetChildBindingSources( IContainer container, BindingSource parent, BindingSourceNode parentNode) { List <BindingSourceNode> children = new List <BindingSourceNode>(); #if !WEBGUI foreach (System.ComponentModel.Component component in container.Components) #else foreach (IComponent component in container.Components) #endif { if (component is BindingSource) { BindingSource temp = component as BindingSource; if (temp.DataSource != null && temp.DataSource.Equals(parent)) { BindingSourceNode childNode = new BindingSourceNode(temp); children.Add(childNode); childNode.Children.AddRange(GetChildBindingSources(container, temp, childNode)); childNode.Parent = parentNode; } } } return(children); }
private static List<BindingSourceNode> GetChildBindingSources( IContainer container, BindingSource parent, BindingSourceNode parentNode) { List<BindingSourceNode> children = new List<BindingSourceNode>(); #if !WEBGUI foreach (System.ComponentModel.Component component in container.Components) #else foreach (IComponent component in container.Components) #endif { if (component is BindingSource) { BindingSource temp = component as BindingSource; if (temp.DataSource != null && temp.DataSource.Equals(parent)) { BindingSourceNode childNode = new BindingSourceNode(temp); children.Add(childNode); childNode.Children.AddRange(GetChildBindingSources(container, temp, childNode)); childNode.Parent = parentNode; } } } return children; }
/// <summary> /// Sets up BindingSourceNode objects for all /// BindingSource objects related to the provided /// root source. /// </summary> /// <param name="container"> /// Container for the components. /// </param> /// <param name="rootSource"> /// Root BindingSource object. /// </param> /// <returns></returns> public static BindingSourceNode InitializeBindingSourceTree( IContainer container, BindingSource rootSource) { if (rootSource == null) throw new ApplicationException(Resources.BindingSourceNotProvided); _rootSourceNode = new BindingSourceNode(rootSource); _rootSourceNode.Children.AddRange(GetChildBindingSources(container, rootSource, _rootSourceNode)); return _rootSourceNode; }
/// <summary> /// Sets up BindingSourceNode objects for all /// BindingSource objects related to the provided /// root source. /// </summary> /// <param name="container"> /// Container for the components. /// </param> /// <param name="rootSource"> /// Root BindingSource object. /// </param> /// <returns></returns> public static BindingSourceNode InitializeBindingSourceTree( IContainer container, BindingSource rootSource) { if (rootSource == null) { throw new ApplicationException(Resources.BindingSourceNotProvided); } _rootSourceNode = new BindingSourceNode(rootSource); _rootSourceNode.Children.AddRange(GetChildBindingSources(container, rootSource, _rootSourceNode)); return(_rootSourceNode); }
/// <summary> /// Resets all action behaviors. /// </summary> /// <param name="objectToBind">Target object.</param> public void ResetActionBehaviors(ISavable objectToBind) { InitializeControls(true); BindingSource rootSource = _dataSource as BindingSource; if (rootSource != null) { AddEventHooks(objectToBind); } _bindingSourceTree = BindingSourceHelper.InitializeBindingSourceTree(_container, rootSource); _bindingSourceTree.Bind(objectToBind); }
private void BindUI() { _bindingTree = BindingSourceHelper.InitializeBindingSourceTree(components, orderBindingSource); _bindingTree.Bind(_order); }