Exemple #1
0
 private void PoolContainer(ref InternalSpinBox.SpinList.ListContainer container)
 {
     if (container != null)
     {
         this.poolItem.Add(container);
         container.listItem.Visible = false;
     }
 }
Exemple #2
0
 public ListContainer()
 {
     this.next       = null;
     this.prev       = null;
     this.listItem   = null;
     this.totalId    = 0;
     this.updateFlag = false;
 }
Exemple #3
0
 private InternalSpinBox.SpinList.ListContainer GetContainer()
 {
     InternalSpinBox.SpinList.ListContainer listContainer = new InternalSpinBox.SpinList.ListContainer();
     if (this.poolItem.Count != 0)
     {
         listContainer = this.poolItem[0];
         this.poolItem.RemoveAt(0);
         listContainer.listItem.Visible       = true;
         listContainer.listItem.TouchResponse = true;
     }
     else
     {
         listContainer          = new InternalSpinBox.SpinList.ListContainer();
         listContainer.listItem = null;
     }
     return(listContainer);
 }
Exemple #4
0
 private void CreateListItem(ref InternalSpinBox.SpinList.ListContainer listContainer, int index)
 {
     InternalSpinBox.SpinItem spinItem;
     if (listContainer.listItem == null)
     {
         spinItem = new InternalSpinBox.SpinItem();
     }
     else
     {
         spinItem = listContainer.listItem;
     }
     listContainer.listItem   = spinItem;
     listContainer.totalId    = index;
     listContainer.updateFlag = true;
     spinItem.ItemId          = this.CalcItemIndex(index);
     this.basePanel.AddChildLast(spinItem);
     spinItem.ProtectedSelectAction += new InternalSpinBox.SpinItem.ProtectedSelectActionHandler(this.OnSelectHandler);
     spinItem.IsFocused              = (this.focusIndex == this.CalcItemIndex(index));
 }
Exemple #5
0
 private void ItemFocusChanged(object sender, EventArgs e)
 {
     if (this.Style == SpinBoxStyle.Date)
     {
         int daysInMonth = this.GetDaysInMonth();
         int num         = this.listMiddle.ScrollAreaFirstLine + SpinBox.visibleCount / 2 + 1;
         if (num > this.listMiddle.TotalLineNum)
         {
             num -= this.listMiddle.TotalLineNum;
         }
         if (num > daysInMonth)
         {
             if (daysInMonth < 30 && num > 30)
             {
                 this.listMiddle.ScrollTo(29, 0f, true);
             }
             else
             {
                 int num2 = daysInMonth - 1;
                 this.listMiddle.ScrollTo(num2 - SpinBox.visibleCount / 2, 0f, true);
             }
         }
         else if (this.ValueChanged != null)
         {
             this.ValueChanged.Invoke(this, new SpinBoxValueChangedEventArgs());
         }
         using (List <InternalSpinBox.SpinList.ListContainer> .Enumerator enumerator = this.listMiddle.listItem.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 InternalSpinBox.SpinList.ListContainer current = enumerator.Current;
                 current.listItem.Enabled = (current.listItem.ItemId + 1 <= daysInMonth);
             }
             return;
         }
     }
     if (this.ValueChanged != null)
     {
         this.ValueChanged.Invoke(this, new SpinBoxValueChangedEventArgs());
     }
 }
Exemple #6
0
            private void UpdateListItem(bool isMod)
            {
                int num  = this.ScrollAreaFirstLine - (int)this.cacheLineCount;
                int num2 = this.ScrollAreaFirstLine + (int)this.scrollAreaLineNum + (int)this.cacheLineCount + 1;

                if (!this.IsLoop)
                {
                    if (num < 0)
                    {
                        num = 0;
                    }
                    if (num2 > this.listItemNum)
                    {
                        num2 = this.listItemNum;
                    }
                }
                bool flag = isMod;

                InternalSpinBox.SpinList.ListContainer listContainer = new InternalSpinBox.SpinList.ListContainer();
                if (this.cacheEndIndex - 1 >= num)
                {
                    if (num2 - 1 >= this.cacheStartIndex)
                    {
                        if (this.cacheStartIndex == num && this.cacheEndIndex == num2)
                        {
                            goto IL_1F5;
                        }
                        if (this.cacheStartIndex < num)
                        {
                            for (int i = num - 1; i >= this.cacheStartIndex; i--)
                            {
                                listContainer = this.listItem[0];
                                this.listItem.RemoveAt(0);
                                this.PoolContainer(ref listContainer);
                                flag = true;
                            }
                        }
                        if (this.cacheEndIndex > num2)
                        {
                            for (int j = num2; j < this.cacheEndIndex; j++)
                            {
                                listContainer = this.listItem[this.listItem.Count - 1];
                                this.listItem.RemoveAt(this.listItem.Count - 1);
                                this.PoolContainer(ref listContainer);
                                flag = true;
                            }
                        }
                        if (this.cacheStartIndex > num)
                        {
                            for (int k = this.cacheStartIndex - 1; k >= num; k--)
                            {
                                listContainer = this.GetContainer();
                                this.CreateListItem(ref listContainer, k);
                                this.listItem.Insert(0, listContainer);
                                flag = true;
                            }
                        }
                        if (this.cacheEndIndex < num2)
                        {
                            for (int l = this.cacheEndIndex; l < num2; l++)
                            {
                                listContainer = this.GetContainer();
                                this.CreateListItem(ref listContainer, l);
                                this.listItem.Add(listContainer);
                                flag = true;
                            }
                            goto IL_1F5;
                        }
                        goto IL_1F5;
                    }
                }
                while (this.listItem.Count != 0)
                {
                    listContainer = this.listItem[0];
                    this.listItem.RemoveAt(0);
                    this.PoolContainer(ref listContainer);
                    flag = true;
                }
                for (int m = num; m < num2; m++)
                {
                    listContainer = this.GetContainer();
                    this.CreateListItem(ref listContainer, m);
                    this.listItem.Add(listContainer);
                    flag = true;
                }
IL_1F5:
                this.cacheStartIndex = num;
                this.cacheEndIndex   = num2;
                if (flag)
                {
                    for (int n = 0; n < this.listItem.Count; n++)
                    {
                        int totalId = this.listItem[n].totalId;
                        this.listItem[n].listItem.X = this.CalcItemPosOnScrollNodeX(totalId);
                        this.listItem[n].listItem.Y = this.CalcItemPosOnScrollNodeY(totalId);
                        if (this.listItem[n].updateFlag && this.ItemRequestAction != null)
                        {
                            InternalSpinBox.SpinItemRequestEventArgs spinItemRequestEventArgs = new InternalSpinBox.SpinItemRequestEventArgs();
                            spinItemRequestEventArgs.Index = this.listItem[n].totalId;
                            this.ItemRequestAction.Invoke(this, spinItemRequestEventArgs);
                            this.listItem[n].updateFlag = false;
                        }
                    }
                }
                for (int num3 = 0; num3 < this.listItem.Count; num3++)
                {
                    float num4 = this.listItem[num3].listItem.Y + this.listItem[num3].listItem.Height + this.basePanel.Y;
                    int   num5 = this.ScrollAreaLineNum / 2 + 1;
                    if (num4 <= this.listItem[num3].listItem.Height * (float)num5)
                    {
                        this.listItem[num3].listItem.Alpha = num4 / (this.listItem[num3].listItem.Height * (float)num5);
                    }
                    else
                    {
                        this.listItem[num3].listItem.Alpha = 2f - num4 / (this.listItem[num3].listItem.Height * (float)num5);
                    }
                }
            }