Ejemplo 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));
        }
Ejemplo n.º 2
0
        public List <T> GetDataSource <T>()
        {
            if (base.DataSource == null)
            {
                return(new List <T>());
            }
            BindingGridList <T> BindingData = (BindingGridList <T>)base.DataSource;

            return(new List <T>(BindingData));
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public bool ReBind <T>(IList <T> EntityList, bool Append)
 {
     if (EntityList == null)
     {
         return(false);
     }
     this.Invoke(new InvokeHandler(delegate()
     {
         BindingGridList <T> tmpData = new BindingGridList <T>();
         if (base.DataSource != null)
         {
             if (Append)
             {
                 tmpData = (BindingGridList <T>)base.DataSource;
                 foreach (T item in EntityList)
                 {
                     tmpData.Add(item);
                 }
             }
             else
             {
                 tmpData          = new BindingGridList <T>(EntityList);
                 CurrentPageIndex = 1;
             }
             base.DataSource = new BindingGridList <T>();
             base.DataSource = tmpData;
             this.Refresh();
             if (Append && EntityList.Count == 1)
             {
                 if (this.RowCount > 0 && this.CurrentCell != null)
                 {
                     this.CurrentCell = this[CurrentCell.ColumnIndex, this.RowCount - 1];
                 }
             }
         }
         else
         {
             base.DataSource = new BindingGridList <T>(EntityList);
             this.Refresh();
             CurrentPageIndex = 1;
         }
         SetAutoWidth();
     }));
     return(true);
 }
Ejemplo n.º 5
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);
 }
Ejemplo n.º 6
0
        public bool ReBind <T>(T Entity, int RowIndex)
        {
            bool ReturnValue = false;

            this.Invoke(new InvokeHandler(delegate()
            {
                if (RowIndex < 0)
                {
                    return;
                }
                BindingGridList <T> tmpData = (BindingGridList <T>)base.DataSource;
                if (tmpData != null)
                {
                    tmpData[RowIndex]            = Entity;
                    base.DataSource              = new BindingGridList <T>();
                    base.DataSource              = tmpData;
                    this.Rows[RowIndex].Selected = true;
                    ReturnValue = true;
                }
            }));
            return(ReturnValue);
        }
Ejemplo n.º 7
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);
        }