Ejemplo n.º 1
0
        /// <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;
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        private static List <BindingSourceNode> GetChildBindingSources(
            IContainer container, BindingSource parent, BindingSourceNode parentNode)
        {
            List <BindingSourceNode> children = new List <BindingSourceNode>();

            foreach (Component component in container.Components)
            {
                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);
        }
Ejemplo n.º 5
0
        private static List<BindingSourceNode> GetChildBindingSources(
      IContainer container, BindingSource parent, BindingSourceNode parentNode)
        {
            List<BindingSourceNode> children = new List<BindingSourceNode>();

              foreach (Component component in container.Components)
              {
            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;
        }
Ejemplo n.º 6
0
    /// <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);
    }
Ejemplo n.º 7
0
 private void BindUI()
 {
   _bindingTree = BindingSourceHelper.InitializeBindingSourceTree(components, orderBindingSource);
   _bindingTree.Bind(_order);
 }