public DataSourceBase(racerSportType sportType, bool isHuman) { this.sportType = sportType; this.isHuman = isHuman; uid = ++uidCount; if (uidCount == byte.MaxValue) { uidCount = byte.MaxValue - 1; //If we overflow just stay at max instead of colliding with earlier values } }
public RaceTrack getDefaultRaceTrack(racerSportType sportType) { foreach (RaceTrack i in enabledRaceTracks) { if (i.sportType == sportType) { return(i); } } return(new RaceTrack() { sportType = racerSportType.Unknown, distance = 499 }); }
//TrackRecords.RecordData recordHolder; public ds_TrackRecord(racerSportType sportType, double trackDistance) : base(sportType) { /* TrackRecords.RecordDatabase db = TrackRecords.RecordDatabase.getInstance(); * TrackRecords.TrackRecordList recordList = db.getTrackRecordList(sportType, trackDistance); * * if (recordList == null || recordList.trackRecords.Count <= 0) * { * initPaceTimer(2); //Default to super slow if there is no track record * recordHolderDisplay = "No Track Record Exists"; * } * else * { * recordHolder = recordList.trackRecords[0]; * initPaceTimer(trackDistance / recordHolder.recordValue); * recordHolderDisplay = recordHolder.FirstName + ": " + trackDistance + "m in " + recordHolder.recordValue + "s";//(speedMs * 3.6).ToString("0.0") + "kph"; * } */ }
private void populateDistanceBox(racerSportType sport) { ComboBox_RaceLength.Items.Clear(); RacerDetails selectedRacer = null; if (racerIndexUnderConfig >= 0) { selectedRacer = configuredRacers[racerIndexUnderConfig]; ComboBox_RaceLength.Items.Add(new Label() { Content = selectedRacer.targetValue.ToString() + "m track" }); } //Add all available values foreach (AntPlusRacerConfig.RaceTrack i in AntPlusRacerConfig.getInstance().enabledRaceTracks) { if (i.sportType == sport) { //Skip the current value because we already added it if (selectedRacer != null && selectedRacer.targetValue == i.distance) { continue; } ComboBox_RaceLength.Items.Add(new Label() { Content = i.distance.ToString() + "m track" }); } } if (ComboBox_RaceLength.Items.Count == 0) { ComboBox_RaceLength.Items.Add(new Label() { Content = "499m track" }); } ComboBox_RaceLength.SelectedIndex = 0; comboBoxAutoLblFontSize(ComboBox_RaceLength); }
public TrackRecordList getTrackRecordList(racerSportType sportType, double distance) { foreach (TrackRecordList i in recordBook) { if (i.sportType == sportType && i.trackDistance == distance) { return(i); } } //Create a new list if there are no matches TrackRecordList newRecordList = new TrackRecordList(); newRecordList.sportType = sportType; newRecordList.trackDistance = distance; newRecordList.trackRecords = new List <RecordData>(); recordBook.Add(newRecordList); return(newRecordList); }
public static BitmapImage getRaceDisplayBitmap(racerSportType sportType) { //TODO: qc Should share all the bitmap images as static resources for animations and these displays BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); switch (sportType) { case racerSportType.Biking: bmp.UriSource = new Uri("./Animations/Cycling/cycling10.gif", UriKind.Relative); break; case racerSportType.Running: bmp.StreamSource = Application.GetResourceStream(new Uri("pack://application:,,,/Images/Race Icons/runner_icon.png")).Stream; break; case racerSportType.Rowing: bmp.UriSource = new Uri("./Animations/Rowing/rowing_agif15.gif", UriKind.Relative); break; case racerSportType.Skiing: bmp.StreamSource = Application.GetResourceStream(new Uri("pack://application:,,,/Images/Race Icons/skier_icon.png")).Stream; break; case racerSportType.Unknown: bmp.StreamSource = Application.GetResourceStream(new Uri("pack://application:,,,/Images/ANT+ logo w_TM.png")).Stream; break; default: return(null); } bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.EndInit(); return(bmp); }
public RacerInfoPanel(racerSportType raceType, double targetValue) { InitializeComponent(); loadAnimationPics(); progressBar1.Maximum = targetValue; updateProgressDisplay(0, 0); switch (raceType) { case racerSportType.Biking: curAnimPics = cyclingPics; Label_Cadence.Content = "0 rpm"; Border_PowerLabelHolder.Visibility = System.Windows.Visibility.Hidden; Grid.SetColumnSpan(Border_ProgressLabelHolder, 3); break; case racerSportType.Running: curAnimPics = runningPics; Label_Cadence.Content = "0 spm"; Border_PowerLabelHolder.Visibility = System.Windows.Visibility.Hidden; Grid.SetColumnSpan(Border_ProgressLabelHolder, 3); break; case racerSportType.Rowing: curAnimPics = rowingPics; Label_Cadence.Content = "0 spm"; break; case racerSportType.Skiing: curAnimPics = skiingPics; Label_Cadence.Content = "0 spm"; break; } initAnimation(); }
public ds_AntPlus_RxFailInterpBuf(String sourceName, racerSportType sportType) : base(sourceName, sportType) { }
public ds_AntPlus(String defaultSourceName, racerSportType sportType) : base(sportType, true) { this.sourceName = defaultSourceName; this.searchProfile = getDefaultSearchProfile(); }
public ds_PaceSimulator(racerSportType sportType) : base(sportType, false) { ////RowingPower //power = (ushort)Math.Round(2.8 / Math.Pow(1 / speedMs, 3)); //watts = 2.80/pace³ - source: www.concept2.com/us/interactive/calculators/watts.asp }