Esempio n. 1
0
 private void checkPits(RaceBarItem raceBarItem, LiveStandingsItem liveStandingsItem)
 {
     if (liveStandingsItem.InPits)
     {
         raceBarItem.PitText.Visibility = Visibility.Visible;
         raceBarItem.GapText.Visibility = Visibility.Hidden;
     }
     else
     {
         raceBarItem.PitText.Visibility = Visibility.Hidden;
         raceBarItem.GapText.Visibility = Visibility.Visible;
     }
 }
Esempio n. 2
0
        private void LoadPage(int index, bool clearImprs)
        {
            if (index == 0)
            {
                oldMode = Mode;
            }

            UIElementCollection items = RaceBarBackground.Children;
            int j = 0;

            for (int i = index; i < index + 5; i++)
            {
                RaceBarItem       item   = (RaceBarItem)items[j++];
                int               pos    = j + (index * 5);
                LiveStandingsItem stItem = Module.Items.Find(it => it.PositionLive == pos);
                if (stItem == null)
                {
                    item.Show = false;
                    continue;
                }

                if (clearImprs)
                {
                    stItem.PositionImprovedRaceBar = stItem.PositionLostRaceBar = false;
                }

                item.Show = true;

                if (stItem.PositionLive == 1)
                {
                    item.NumberLeader.Visibility = Visibility.Visible;
                }
                else
                {
                    item.NumberLeader.Visibility = Visibility.Hidden;
                }

                item.Position.Text          = stItem.PositionLive.ToString();
                item.ClassColorLeader.Color = stItem.Driver.LicColor; // TODO ClassColor
                item.ClassColorNormal.Color = stItem.Driver.LicColor;

                /*
                 * if (stItem.PositionImprovedRaceBar)
                 * {
                 *  item.PositionImproved();
                 *  stItem.PositionImprovedRaceBar = false;
                 * }
                 *
                 * if (stItem.PositionLostRaceBar)
                 * {
                 *  item.PositionLost();
                 *  stItem.PositionLostRaceBar = false;
                 * }
                 */
                switch (oldMode)
                {
                case RaceBarMode.Gap:
                    item.ThreeLetterCode.Visibility = Visibility.Visible;
                    item.GapText.Visibility         = Visibility.Visible;
                    item.DriverName.Visibility      = Visibility.Hidden;

                    checkPits(item, stItem);

                    item.ThreeLetterCode.Text = stItem.Driver.ThreeLetterCode;
                    if (stItem.PositionLive == 1)
                    {
                        item.GapText.Text = "Leader";
                    }
                    else
                    {
                        if (stItem.GapLaps == 0)
                        {
                            if (Live)
                            {
                                item.GapText.Text = "+" + stItem.GapLiveLeader.ConvertToTimeString();
                            }
                            else
                            {
                                item.GapText.Text = "+" + stItem.GapTime.ConvertToTimeString();
                            }
                        }
                        else
                        {
                            item.GapText.Text = "+" + stItem.GapLaps.ToString() + (stItem.GapLaps == 1 ? " Lap" : " Laps");
                        }
                    }
                    break;

                case RaceBarMode.Interval:
                    item.ThreeLetterCode.Visibility = Visibility.Visible;
                    item.GapText.Visibility         = Visibility.Visible;
                    item.DriverName.Visibility      = Visibility.Hidden;

                    checkPits(item, stItem);

                    item.ThreeLetterCode.Text = stItem.Driver.ThreeLetterCode;
                    if (stItem.PositionLive == 1)
                    {
                        item.GapText.Text = "Interval";
                    }
                    else
                    {
                        float gap = 0;
                        if (Live)
                        {
                            gap = stItem.GapLive;
                        }
                        else
                        {
                            LiveStandingsItem stItem2 = Module.Items.Find(it => it.PositionLive == (j + (index * 5)) - 1);
                            gap = stItem.GapTime - stItem2.GapTime;
                        }

                        item.GapText.Text = "+" + gap.ConvertToTimeString();
                    }
                    break;

                case RaceBarMode.Name:
                    item.ThreeLetterCode.Visibility = Visibility.Hidden;
                    item.GapText.Visibility         = Visibility.Hidden;
                    item.PitText.Visibility         = Visibility.Hidden;
                    item.DriverName.Visibility      = Visibility.Visible;

                    item.DriverName.Text = stItem.Driver.LastUpperName;
                    break;

                default:
                    break;
                }
            }
        }