Example #1
0
        /// <summary>
        /// Updates list content with information from the datasource
        /// </summary>
        protected virtual void UpdateDataSource()
        {
            if (Element != null && BindingContext != null && DataSource != null)
            {
                DataManager = (CurrencyManager)BindingContext[DataSource];

                var container = GetItemsContainer();
                for (var i = 0; i < DataManager.List.Count; ++i)
                {
                    using (var item = CreateItem(i, DataManager.List[i]))
                        container.InsertElement(item.Element, i);
                }

                // Force selected item update (needed to refresh caption in the dropdown)
                ProcessItemChanged(DataManager.Position);
                Element.Update();
            }
            else
            {
                DataManager = null;
            }
        }
 public BindingSource(object dataSource, string dataMember)
 {
     this.dataMember = string.Empty;
     this.raiseListChangedEvents = true;
     this.allowNewSetValue = true;
     this.addNewPos = -1;
     this.dataSource = dataSource;
     this.dataMember = dataMember;
     this._innerList = new ArrayList();
     this.currencyManager = new System.Windows.Forms.CurrencyManager(this);
     this.WireCurrencyManager(this.currencyManager);
     this.ResetList();
     this.listItemPropertyChangedHandler = new EventHandler(this.ListItem_PropertyChanged);
     this.WireDataSource();
 }
Example #3
0
 public DataGridTableStyle(System.Windows.Forms.CurrencyManager listManager)
 {
     throw new NotImplementedException(".ctor");
 }
Example #4
0
 protected internal override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum)
 {
     throw new NotImplementedException("Paint");
 }
Example #5
0
 public static void RefreshData(this System.Windows.Forms.ListControl list)
 {
     System.Windows.Forms.CurrencyManager myCurrencyManager = (System.Windows.Forms.CurrencyManager)list.BindingContext[list.DataSource];
     myCurrencyManager.Refresh();
 }
Example #6
0
 protected internal override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, System.String instantText, bool cellIsVisible)
 {
     throw new NotImplementedException("Edit");
 }
Example #7
0
 protected internal override System.Object GetColumnValueAtRow(System.Windows.Forms.CurrencyManager lm, int row)
 {
     throw new NotImplementedException("GetColumnValueAtRow");
 }
Example #8
0
 protected internal override bool Commit(System.Windows.Forms.CurrencyManager dataSource, int rowNum)
 {
     throw new NotImplementedException("Commit");
 }
Example #9
0
 protected internal override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
 {
     throw new NotImplementedException("Paint");
 }
 protected override void Edit(System.Windows.Forms.CurrencyManager source,
                              int rowNum,
                              System.Drawing.Rectangle bounds,
                              bool breadOnly, string instantText, bool cellsVisible)
 {
 }
 public void SetDataConnection(object dataSource, string dataMember)
 {
     if (!this.dataConnectionState[1])
     {
         this.ResetDataConnectionState();
         if (dataMember == null)
         {
             dataMember = string.Empty;
         }
         ISupportInitializeNotification notification = this.dataSource as ISupportInitializeNotification;
         if ((notification != null) && this.dataConnectionState[0x40000])
         {
             notification.Initialized -= new EventHandler(this.DataSource_Initialized);
             this.dataConnectionState[0x40000] = false;
         }
         this.dataSource = dataSource;
         this.dataMember = dataMember;
         if (this.owner.BindingContext != null)
         {
             this.dataConnectionState[1] = true;
             try
             {
                 this.UnWireEvents();
                 if (((this.dataSource != null) && (this.owner.BindingContext != null)) && (this.dataSource != Convert.DBNull))
                 {
                     notification = this.dataSource as ISupportInitializeNotification;
                     if ((notification != null) && !notification.IsInitialized)
                     {
                         if (!this.dataConnectionState[0x40000])
                         {
                             notification.Initialized += new EventHandler(this.DataSource_Initialized);
                             this.dataConnectionState[0x40000] = true;
                         }
                         this.currencyManager = null;
                     }
                     else
                     {
                         this.currencyManager = this.owner.BindingContext[this.dataSource, this.dataMember] as System.Windows.Forms.CurrencyManager;
                     }
                 }
                 else
                 {
                     this.currencyManager = null;
                 }
                 this.WireEvents();
                 if (this.currencyManager != null)
                 {
                     this.props = this.currencyManager.GetItemProperties();
                 }
                 else
                 {
                     this.props = null;
                 }
             }
             finally
             {
                 this.dataConnectionState[1] = false;
             }
             this.ResetCachedAllowUserToAddRowsInternal();
             if (this.currencyManager != null)
             {
                 this.lastListCount = this.currencyManager.Count;
             }
             else
             {
                 this.lastListCount = -1;
             }
         }
     }
 }
 public void Dispose()
 {
     this.UnWireEvents();
     this.currencyManager = null;
 }