// typedef struct // { // uint16 track_index; /* Index of associated track */ // uint16 first_lap_index; /* Index of first associated lap */ // uint16 last_lap_index; /* Index of last associated lap */ // uint8 sport_type; /* Same as D1000 */ // uint8 program_type; /* See below */ // uint8 multisport; /* See below */ // uint8 unused1; /* Unused. Set to 0. */ // uint16 unused2; /* Unused. Set to 0. */ // struct // { // uint32 time; /* Time result of quick workout */ // float32 distance; /* Distance result of quick workout */ // } quick_workout; // D1008_Workout_Type workout; /* Workout */ // } D1009_Run_Type; public static Run CreateFrom(D1009_Run_Type run_struct) { var run = new Run(); run.TrackIndex = run_struct.track_index; run.FirstLapIndex = run_struct.first_lap_index; run.LastLapIndex = run_struct.last_lap_index; run.SportType = (SportType) run_struct.sport_type; run.ProgramType = run_struct.program_type; run.MultiSport = (MultiSport) run_struct.multisport; run.QuickWorkout = run_struct.quick_workout; run.Workout = Workout.CreateFrom(run_struct.workout); return run; }
public void AddRun(GarminUnit garmin, Run run) { var runs = new Runs() { FirstLapIndex = run.FirstLapIndex, LastLapIndex = run.LastLapIndex, SportType = (int) run.SportType, ProgramType = run.ProgramType, MultiSport = (int) run.MultiSport, // QuickWorkout = (int) run.QuickWorkout, // Workout = (int) run.Workout, // VirtualPartner = (int) run.VirtualPartner }; database.Runs.InsertOnSubmit(runs); database.SubmitChanges(); }
public RunNode(Run Run) { this.run = Run; this.foo = run.TrackIndex.ToString(); }
public bool ContainsRun(GarminUnit garmin, Run run) { if ( database.Runs.Count() == 0 ) return false; var runs = from r in database.Runs where r.GarminDevice == (int) garmin.ID where r.FirstLapIndex == (int) run.FirstLapIndex where r.LastLapIndex == (int) run.LastLapIndex select r; return (runs.Count() > 0); }