Esempio n. 1
0
        public bool ReBindSingle(object element, Type ElementType, bool Append)
        {
            IList list = (IList)BindingGridList.GetTypeList(ElementType);

            list.Add(element);
            return(ReBind(list, ElementType, Append));
        }
Esempio n. 2
0
        public bool RemoveBind(Type EntityType, object Entity)
        {
            this.Invoke(new InvokeHandler(delegate()
            {
                if (base.DataSource != null)
                {
                    object tmpData = base.DataSource;
                    ((IList)tmpData).Remove(Entity);
                    base.DataSource = BindingGridList.GetTypeList(EntityType);
                    base.DataSource = tmpData;
                    this.Refresh();
                }
                SetAutoWidth();
            }));

            return(true);
        }
Esempio n. 3
0
 public bool ReBind(IList ElementTypeList, Type ElementType, bool Append)
 {
     if (ElementTypeList == null)
     {
         return(false);
     }
     this.Invoke(new InvokeHandler(delegate()
     {
         object tmpData = BindingGridList.GetTypeList(ElementType);
         if (base.DataSource != null)
         {
             if (Append)
             {
                 tmpData = base.DataSource;
                 foreach (object item in ElementTypeList)
                 {
                     ((IList)tmpData).Add(item);
                 }
             }
             else
             {
                 tmpData          = BindingGridList.GetTypeList(ElementType, ElementTypeList);
                 CurrentPageIndex = 1;
             }
             base.DataSource = BindingGridList.GetTypeList(ElementType);
             base.DataSource = tmpData;
             this.Refresh();
             if (Append && ElementTypeList.Count == 1)
             {
                 if (this.RowCount > 0 && this.CurrentCell != null)
                 {
                     this.CurrentCell = this[CurrentCell.ColumnIndex, this.RowCount - 1];
                 }
             }
         }
         else
         {
             base.DataSource = BindingGridList.GetTypeList(ElementType, ElementTypeList);
             this.Refresh();
             CurrentPageIndex = 1;
         }
         SetAutoWidth();
     }));
     return(true);
 }
Esempio n. 4
0
        public bool ReBind(object Entity, Type ElementType, int RowIndex)
        {
            bool ReturnValue = false;

            this.Invoke(new InvokeHandler(delegate()
            {
                if (RowIndex < 0)
                {
                    return;
                }
                object tmpData = base.DataSource;
                if (tmpData != null)
                {
                    ((IList)tmpData)[RowIndex]   = Entity;
                    base.DataSource              = BindingGridList.GetTypeList(ElementType);
                    base.DataSource              = tmpData;
                    this.Rows[RowIndex].Selected = true;
                    ReturnValue = true;
                }
                SetAutoWidth();
            }));
            return(ReturnValue);
        }