public void Tick()
        {
            LinkedListNode <LiveTimingItem> node = Items.First;

            for (int i = 1; i <= Module.Items.Count; i++)
            {
                int pos = 1;
                if (i > 1)
                {
                    pos = i + (pageIndex * 21);
                }

                LiveStandingsItem item    = Module.Items.Find(it => it.PositionLive == pos);
                LiveTimingItem    current = node.Value;
                current.Tick(item, Mode);

                node = node.Next;
                if (node == null)
                {
                    break;
                }
            }

            if (dummyActive)
            {
                UpadeDummies();
            }

            int j = (((pageIndex + 1) * 21) + 1 < Module.Items.Count) ? pageIndex + 1 : 0;

            if (pageIndex < j && canUpdateButtons)
            {
                nextPageButton.IsEnabled = true;
            }

            foreach (LiveTimingItem item in Items)
            {
                if (item.OldPosition == -1)
                {
                    item.Visibility = Visibility.Hidden;
                }
                else
                {
                    item.Visibility = Visibility.Visible;
                }
            }
        }
        private void UpadeDummies()
        {
            LinkedListNode <LiveTimingItem> node = Dummies.First;

            for (int i = 2; i <= Module.Items.Count; i++)
            {
                int pos = i + (dummyPageIndex * 21);

                LiveStandingsItem item    = Module.Items.Find(it => it.PositionLive == pos);
                LiveTimingItem    current = node.Value;
                current.Tick(item, Mode);

                node = node.Next;
                if (node == null)
                {
                    break;
                }
            }
        }
        public LiveTimingWidget()
        {
            this.InitializeComponent();

            canUpdateButtons = true;
            dummyActive      = false;
            PageSwitcherInnerDummy.Visibility = Visibility.Hidden;

            pageIndex           = 0;
            nextPageCd          = new Timer(pageCd);
            nextPageCd.Elapsed += LoadNextPage;

            prevPageCd          = new Timer(pageCd);
            prevPageCd.Elapsed += LoadPrevPage;

            leaderPageCd          = new Timer(pageCd);
            leaderPageCd.Elapsed += LoadLeaderPage;

            neutralizeTimer          = new Timer(200);
            neutralizeTimer.Elapsed += NeutralizePage;

            changeModeTimer          = new Timer(300);
            changeModeTimer.Elapsed += changeMode;

            Controls tvoC = TMTVO.Controller.TMTVO.Instance.Controls;

            prevPageButton   = tvoC.TimingPrevPage;
            nextPageButton   = tvoC.TimingNextPage;
            leaderPageButton = tvoC.TimingLeaderPage;

            Items   = new LinkedList <LiveTimingItem>();
            Dummies = new LinkedList <LiveTimingItem>();
            int i = 1;

            LiveTimingItem item = Item1;

            item.Flag.Visibility  = Visibility.Hidden;
            item.InPit.Visibility = Visibility.Hidden;

            if (item.Name != "Item1")
            {
                item.NumberLeader.Visibility      = Visibility.Hidden;
                item.BackgroundLeader.Visibility  = Visibility.Hidden;
                item.BackgroundLeader1.Visibility = Visibility.Hidden;
            }

            item.Position.Text = (i++).ToString();

            Items.AddLast(item);

            foreach (UIElement elem in PageSwitcherInner.Children)
            {
                item = (LiveTimingItem)elem;
                item.Flag.Visibility  = Visibility.Hidden;
                item.InPit.Visibility = Visibility.Hidden;
                item.Position.Text    = (i++).ToString();
                Items.AddLast(item);
            }

            foreach (UIElement elem in PageSwitcherInnerDummy.Children)
            {
                item = (LiveTimingItem)elem;
                item.Flag.Visibility  = Visibility.Hidden;
                item.InPit.Visibility = Visibility.Hidden;
                item.Position.Text    = (i++).ToString();
                Dummies.AddLast(item);
            }
        }