Example #1
0
        public int Add(object obj)
        {
            int ti   = 0;
            int sti  = 0;
            int ati  = -1;
            int tbti = -1;

            if (this.Parent != null)
            {
                ti   = this.Parent.TemplateIndex;
                sti  = this.Parent.SelectedTemplateIndex;
                ati  = this.Parent.AlternateTemplateIndex;
                tbti = this.Parent.TextBoxTemplateIndex;
            }
            BoundItem item = new BoundItem(ti, sti, ati, tbti, obj, new PropertyMapping(obj.GetType()));

            return(base.List.Add(item));
        }
Example #2
0
 public void Insert(int index, object obj)
 {
     int ti = 0;
     int sti = 0;
     int ati = -1;
     int tbti = -1;
     if (this.Parent != null)
     {
         ti = this.Parent.TemplateIndex;
         sti = this.Parent.SelectedTemplateIndex;
         ati = this.Parent.AlternateTemplateIndex;
         tbti = this.Parent.TextBoxTemplateIndex;
     }
     BoundItem item = new BoundItem(ti, sti, ati, tbti, obj, new PropertyMapping(obj.GetType()));
     base.List.Insert(index, item);
 }
Example #3
0
 private void ReloadDataSource()
 {
     if (this.m_boundMap != Resco.Controls.AdvancedComboBox.Mapping.Empty)
     {
         this.Items.RemoveByMapping(this.m_boundMap);
     }
     if (this.m_listManager != null)
     {
         this.m_boundMap = new PropertyMapping(this.m_listManager.GetItemProperties());
         if (!this.DelayLoad)
         {
             int insertIndex = 0;
             for (int i = 0; i < this.m_listManager.List.Count; i++)
             {
                 Resco.Controls.AdvancedComboBox.ListItem item = new BoundItem(this.TemplateIndex, this.SelectedTemplateIndex, this.AlternateTemplateIndex, this.TextBoxTemplateIndex, this.m_listManager.List[i], this.m_boundMap as PropertyMapping);
                 int num3 = this.InsertItem(item, insertIndex);
                 if (num3 != insertIndex)
                 {
                     insertIndex = num3;
                 }
             }
         }
         else
         {
             this.m_nItemsLoaded = 0;
         }
     }
     else
     {
         this.m_boundMap = Resco.Controls.AdvancedComboBox.Mapping.Empty;
     }
 }
Example #4
0
 private void InsertItem(int index)
 {
     if (this.m_listManager != null)
     {
         Resco.Controls.AdvancedComboBox.ListItem item = new BoundItem(this.TemplateIndex, this.SelectedTemplateIndex, this.AlternateTemplateIndex, this.TextBoxTemplateIndex, this.m_listManager.List[index], this.m_boundMap as PropertyMapping);
         this.InsertItem(item, index);
     }
     else
     {
         this.ReloadDataSource();
     }
 }
Example #5
0
 internal bool DoDelayLoad()
 {
     bool flag = true;
     if (this.DbConnector.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 if (!this.m_bManualDataLoading && ((this.m_dataSource == null) || (this.m_nItemsLoaded >= this.m_listManager.List.Count)))
     {
         flag = false;
     }
     else
     {
         int height;
         Cursor.Current = Cursors.WaitCursor;
         this.BeginUpdate();
         if (this.m_bManualDataLoading)
         {
             for (height = this.m_list.ClientRectangle.Height; height > 0; height -= this.Items[this.Items.Count - 1].GetHeight(this.Templates))
             {
                 this.m_bManualDataLoading = !this.AddItemManually();
                 if (!this.m_bManualDataLoading)
                 {
                     break;
                 }
             }
         }
         else
         {
             height = this.m_list.ClientRectangle.Height;
             while (this.m_nItemsLoaded < this.m_listManager.List.Count)
             {
                 Resco.Controls.AdvancedComboBox.ListItem item = new BoundItem(this.TemplateIndex, this.SelectedTemplateIndex, this.AlternateTemplateIndex, this.TextBoxTemplateIndex, this.m_listManager.List[this.m_nItemsLoaded], this.m_boundMap as PropertyMapping);
                 this.m_nItemsInserted = this.Items.Count;
                 if (this.InsertItem(item, this.m_nItemsInserted) != this.m_nItemsInserted)
                 {
                     height -= this.Items[this.m_nItemsInserted].GetHeight(this.Templates);
                     if (height < 0)
                     {
                         this.m_nItemsLoaded++;
                         break;
                     }
                 }
                 this.m_nItemsLoaded++;
             }
         }
         if (this.m_nItemsLoaded >= this.ExpectedItems)
         {
             this.ExpectedItems = -1;
         }
         this.EndUpdate();
         Cursor.Current = Cursors.Default;
         this.OnDataLoaded(new DataLoadedEventArgs(!flag));
     }
     if (!flag)
     {
         this.ExpectedItems = -1;
     }
     return flag;
 }
Example #6
0
 public BoundItem(BoundItem toCopy) : this(toCopy.TemplateIndex, toCopy.SelectedTemplateIndex, toCopy.AlternateTemplateIndex, toCopy.TextBoxTemplateIndex, toCopy.Data, new PropertyMapping(toCopy.Data.GetType()))
 {
     this.m_properties = toCopy.m_properties;
 }
Example #7
0
 public BoundItem(BoundItem toCopy)
     : this(toCopy.TemplateIndex, toCopy.SelectedTemplateIndex, toCopy.AlternateTemplateIndex, toCopy.TextBoxTemplateIndex, toCopy.Data, new PropertyMapping(toCopy.Data.GetType()))
 {
     this.m_properties = toCopy.m_properties;
 }