Exemplo n.º 1
0
 public void AddTrack(TrackData trackData)
 {
     //Check if TrackData with given tag already exists.
     if (CurrentTracks.Exists(x => x.Tag == trackData.Tag))
     {
         //Find index of existing data.
         int index = CurrentTracks.FindIndex(x => x.Tag == trackData.Tag);
         //replace existing data with new data.
         CurrentTracks[index] = trackData;
     }
     else
     {
         //Add trackData.
         CurrentTracks.Add(trackData);
     }
 }
Exemplo n.º 2
0
        public void UpdateTrackData(TrackData trackData)
        {
            // Update trackdata
            TrackData trackToEdit = CurrentTracks.Find(x => x.Tag == trackData.Tag);

            trackToEdit.CurrentHorzVel = CalculateTrackSpeed(trackData, trackToEdit);
            trackToEdit.CurrentCourse  = CalculateTrackCourse(trackData, trackToEdit);
            trackToEdit.CurrentXcord   = trackData.CurrentXcord;
            trackToEdit.CurrentYcord   = trackData.CurrentYcord;
            trackToEdit.CurrentZcord   = trackData.CurrentZcord;
            trackToEdit.CurrentHorzVel = trackToEdit.CurrentHorzVel;
            trackToEdit.TimeStamp      = trackData.TimeStamp;

            //Replace old object with new object
            int index = CurrentTracks.FindIndex(x => x.Tag == trackData.Tag);

            CurrentTracks.RemoveAt(index);
            CurrentTracks.Insert(index, trackToEdit);
        }
Exemplo n.º 3
0
        public void RemoveTrack(string tag)
        {
            int index = CurrentTracks.FindIndex(x => x.Tag.Equals(tag));

            CurrentTracks.RemoveAt(index);
        }