示例#1
0
 private void InsertItem(int index)
 {
     if (this.m_listManager != null)
     {
         Row row = new BoundRow(this.TemplateIndex, this.SelectedTemplateIndex, this.m_listManager.List[index], this.m_boundMap as PropertyMapping);
         row.ActiveTemplateIndex = this.ActiveTemplateIndex;
         row.AlternateTemplateIndex = this.AlternateTemplateIndex;
         this.InsertRow(row, index);
     }
     else
     {
         this.ReloadDataSource();
     }
 }
示例#2
0
 private void ReloadDataSource()
 {
     if (this.m_boundMap != Resco.Controls.AdvancedList.Mapping.Empty)
     {
         this.DataRows.RemoveByMapping(this.m_boundMap);
     }
     if (this.m_listManager != null)
     {
         this.m_boundMap = new PropertyMapping(this.m_listManager.GetItemProperties());
         if (!this.m_bDelayLoad)
         {
             int insertIndex = 0;
             for (int i = 0; i < this.m_listManager.List.Count; i++)
             {
                 Row row = new BoundRow(this.TemplateIndex, this.SelectedTemplateIndex, this.m_listManager.List[i], this.m_boundMap as PropertyMapping);
                 row.AlternateTemplateIndex = this.AlternateTemplateIndex;
                 row.ActiveTemplateIndex = this.ActiveTemplateIndex;
                 int num3 = this.InsertRow(row, insertIndex);
                 if (num3 != insertIndex)
                 {
                     insertIndex = num3;
                 }
             }
         }
         else
         {
             this.m_nRowsLoaded = 0;
             this.DoDelayLoad();
         }
     }
     else if (this.m_enumerator != null)
     {
         this.m_boundMap = Resco.Controls.AdvancedList.Mapping.Empty;
         if (!this.m_bDelayLoad)
         {
             int num4 = 0;
             while (this.m_enumerator.MoveNext())
             {
                 if (this.m_boundMap == Resco.Controls.AdvancedList.Mapping.Empty)
                 {
                     this.m_boundMap = new PropertyMapping(this.m_enumerator.Current.GetType());
                 }
                 Row row2 = new BoundRow(this.TemplateIndex, this.SelectedTemplateIndex, this.m_enumerator.Current, this.m_boundMap as PropertyMapping);
                 row2.AlternateTemplateIndex = this.AlternateTemplateIndex;
                 row2.ActiveTemplateIndex = this.ActiveTemplateIndex;
                 int num5 = this.InsertRow(row2, num4);
                 if (num5 != num4)
                 {
                     num4 = num5;
                 }
             }
             this.m_enumeratorNeedLoad = false;
         }
         else
         {
             this.m_nRowsLoaded = 0;
             this.DoDelayLoad();
         }
     }
     else
     {
         this.m_boundMap = Resco.Controls.AdvancedList.Mapping.Empty;
     }
 }
示例#3
0
 private bool DoDelayLoad()
 {
     bool flag = true;
     if (this.m_connector.IsOpen)
     {
         Cursor.Current = Cursors.WaitCursor;
         this.BeginUpdate();
         try
         {
             if (this.LoadDataChunk(true))
             {
                 this.CloseConnector();
                 flag = false;
             }
         }
         catch
         {
             this.CloseConnector();
             flag = false;
         }
         this.EndUpdate();
         Cursor.Current = Cursors.Default;
         this.OnDataLoaded(new DataLoadedEventArgs(!flag));
     }
     else
     {
         Rectangle rectangle = this.CalculateClientRect();
         if ((!this.m_bManualDataLoading && (((this.m_enumerator == null) || !(this.m_dataSource is IEnumerable)) || !this.m_enumeratorNeedLoad)) && (((this.m_dataSource == null) || (this.m_listManager == null)) || (this.m_nRowsLoaded >= this.m_listManager.List.Count)))
         {
             flag = false;
         }
         else
         {
             int height;
             Cursor.Current = Cursors.WaitCursor;
             this.BeginUpdate();
             if (this.m_bManualDataLoading)
             {
                 for (height = rectangle.Height; height > 0; height -= this.m_rcRows[this.m_rcRows.Count - 1].GetHeight(this.Templates))
                 {
                     this.m_bManualDataLoading = !this.AddRowManually();
                     if (!this.m_bManualDataLoading)
                     {
                         flag = false;
                         break;
                     }
                 }
             }
             else if (this.m_enumerator != null)
             {
                 height = rectangle.Height;
                 while (flag = this.m_enumeratorNeedLoad = this.m_enumerator.MoveNext())
                 {
                     if (this.m_boundMap == Resco.Controls.AdvancedList.Mapping.Empty)
                     {
                         this.m_boundMap = new PropertyMapping(this.m_enumerator.Current.GetType());
                     }
                     Row row = new BoundRow(this.TemplateIndex, this.SelectedTemplateIndex, this.m_enumerator.Current, this.m_boundMap as PropertyMapping);
                     row.AlternateTemplateIndex = this.AlternateTemplateIndex;
                     row.ActiveTemplateIndex = this.ActiveTemplateIndex;
                     this.m_nRowsInserted = this.m_rcRows.Count;
                     int num2 = this.InsertRow(row, this.m_nRowsInserted);
                     this.m_nRowsLoaded++;
                     if (num2 != this.m_nRowsInserted)
                     {
                         height -= this.m_rcRows[this.m_nRowsInserted].GetHeight(this.Templates);
                         if (height < 0)
                         {
                             break;
                         }
                     }
                 }
             }
             else
             {
                 height = rectangle.Height;
                 while (this.m_nRowsLoaded < this.m_listManager.List.Count)
                 {
                     Row row2 = new BoundRow(this.TemplateIndex, this.SelectedTemplateIndex, this.m_listManager.List[this.m_nRowsLoaded], this.m_boundMap as PropertyMapping);
                     row2.AlternateTemplateIndex = this.AlternateTemplateIndex;
                     row2.ActiveTemplateIndex = this.ActiveTemplateIndex;
                     this.m_nRowsInserted = this.m_rcRows.Count;
                     if (this.InsertRow(row2, this.m_nRowsInserted) != this.m_nRowsInserted)
                     {
                         height -= this.m_rcRows[this.m_nRowsInserted].GetHeight(this.Templates);
                         if (height < 0)
                         {
                             this.m_nRowsLoaded++;
                             break;
                         }
                     }
                     this.m_nRowsLoaded++;
                 }
                 if (this.m_listManager.List.Count == this.m_nRowsLoaded)
                 {
                     flag = false;
                 }
             }
             if (this.m_nRowsLoaded >= this.m_iExpectedRows)
             {
                 this.m_iExpectedRows = -1;
             }
             this.EndUpdate();
             Cursor.Current = Cursors.Default;
             this.OnDataLoaded(new DataLoadedEventArgs(!flag));
         }
     }
     if (!flag)
     {
         this.ExpectedRows = -1;
     }
     return flag;
 }