public PilotLapsWindow(CPilotRound round) { InitializeComponent(); PilotNameTB.Text = round.Pilot.Name; LapsDataGrid.ItemsSource = round.Laps; }
public CPilot(string name, int round) { Name = name; AssignedRound = round; PilotBestRound = new CPilotRound(); PilotBestRound.ClearBestLap = TimeSpan.MaxValue; PilotBestRound.TotalTime = TimeSpan.MaxValue; Visible = false; }
public CPilotRound Clone() { var clone = new CPilotRound(); clone.Pilot = Pilot.Clone(); clone.TotalTime = TotalTime; clone.BestLap = BestLap; clone.LastLap = LastLap; clone.ClearBestLap = ClearBestLap; clone.ClearBestLapNo = ClearBestLapNo; clone.BestLapNo = BestLapNo; clone.PenaltyCount = PenaltyCount; clone.Laps = new List <CLap>(Laps); return(clone); }
public MainWindow() { InitializeComponent(); nextTimer = new Timer(); //var googleSearchText = File.ReadAllText("c:\\fril.json"); //JObject googleSearch = JObject.Parse(googleSearchText); // get JSON result objects into a list //IList<JToken> results = googleSearch["data"].Children().ToList(); // serialize JSON results into .NET objects //IList<CRaceJSONData> searchResults = new List<CRaceJSONData>(); //foreach (JToken result in results) //{ // CRaceJSONData searchResult = JsonConvert.DeserializeObject<CRaceJSONData>(result.ToString()); // searchResults.Add(searchResult); //} var pre = new PreWindow(); pre.ShowDialog(); int minTime = Settings.Default.minLapTime; lapMinTime = new TimeSpan(0, 0, minTime); RaceType = (RaceTypeEnum)pre.RaceType; if (pre.PilotList.Count == 0) { Close(); } if (pre.PilotList != null) { Pilots = pre.PilotList; } if (pre.RoundList != null) { Rounds = pre.RoundList; } penalty = pre.PenaltyCost; totalLaps = int.Parse(pre.NoLapsBox.Text); foreach (var round in Rounds) { foreach (CPilot pilotInRound in round.RoundPilots) { var pilotRound = new CPilotRound(); pilotRound.Pilot = pilotInRound; round.PilotsLaps.Add(pilotRound); pilotRound.Active = true; } } if (Pilots != null && Rounds != null && Rounds.Count > 0) { currRound = Rounds[0]; nextRound = Rounds[1]; SetupRound(currRound); } switch (RaceType) { case RaceTypeEnum.BestLap: DescLabel.Content = "Race Type: Best Lap"; penalty = 0; totalTimeCol.Visibility = Visibility.Collapsed; TopPilotLabel.Content = "Top Pilots - By Best Lap"; break; case RaceTypeEnum.TotalTime: DescLabel.Content = "Race Type: Total Time, In " + pre.NoLapsBox.Text + " Laps"; TopPilotLabel.Content = "Top Pilots - By Best Total Time"; break; } }