private void NotifyTrackSolutions(IntPtr handle, MDP_NOTIFY_TYPE nType, IntPtr tracksolutionarray, uint count, IntPtr context) { var trackSolutions = TrackSolution.FromNativePointerArray(tracksolutionarray, count, _mta); switch (nType) { case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT: case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT: case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE: trackSolutions.ForEach(ts => _tracksolutions[ts.ID] = ts); _allTrackSolutionDataAvailable = true; break; case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE: trackSolutions.ForEach(ts => _tracksolutions.Remove(ts.ID)); break; case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR: _allTrackSolutionDataAvailable = false; _tracksolutions.Clear(); break; } if (NotifyTrackSolutionHandlers != null) { NotifyTrackSolutionHandlers(nType, trackSolutions, _mta); } }
public SequenceSegment FindSequenceSegment(TrackSolution trackSolution, UInt32 id) { return(_sequenceSegments.ContainsKey(trackSolution.ID) && _sequenceSegments[trackSolution.ID].ContainsKey(id) ? _sequenceSegments[trackSolution.ID][id] : null); }
public ReadOnlyCollection <SequenceSegment> SequenceSegments(TrackSolution trackSolution) { if (!_sequenceSegments.ContainsKey(trackSolution.ID)) { return(new List <SequenceSegment>().AsReadOnly()); } return(_sequenceSegments[trackSolution.ID].Values.ToList().AsReadOnly()); }
/// <summary> /// Request a modifier to insert a new Sequence /// </summary> /// <exception cref="MylapsException"> /// Throws an exception whenever it failed to create a SequenceModifier instance /// </exception> /// <remarks> /// To commit the changes, use MTA.CommitChanges() /// </remarks> public SequenceModifier InsertSequence(TrackSolution trackSolution, UInt32 id) { if (!_tracksolutions.ContainsKey(trackSolution.ID)) { throw new MylapsException("failed to create a SequenceModifier, tracksolution ID:" + trackSolution.ID + " is unknown"); } return(AddSequenceModifier(NativeMethods.mta_sequence_insert(_nativeHandle, trackSolution.NativePointer, id))); }
public ReadOnlyCollection <Sector> Sectors(TrackSolution trackSolution) { if (!_sectors.ContainsKey(trackSolution.ID)) { return(new List <Sector>().AsReadOnly()); } return(_sectors[trackSolution.ID].Values.ToList().AsReadOnly()); }
public ReadOnlyCollection <SequenceSegment> FindSequenceSegmentsBySequence(TrackSolution trackSolution, Sequence sequence) { if (_sequenceSegments.ContainsKey(trackSolution.ID)) { List <SequenceSegment> result = new List <SequenceSegment>(); foreach (SequenceSegment seqSeg in _sequenceSegments[trackSolution.ID].Values.ToList()) { if (seqSeg.SequenceID == sequence.ID) { result.Add(seqSeg); } } return(result.AsReadOnly()); } else { return(new List <SequenceSegment>().AsReadOnly()); } }
public SequenceSegmentModifier InsertSequenceSegment(TrackSolution trackSolution) { return(InsertSequenceSegment(trackSolution, UInt32.MaxValue)); }
public SectorModifier InsertSector(TrackSolution trackSolution) { return(InsertSector(trackSolution, UInt32.MaxValue)); }
public Sector FindSector(TrackSolution trackSolution, UInt32 id) { return(_sectors.ContainsKey(trackSolution.ID) && _sectors[trackSolution.ID].ContainsKey(id) ? _sectors[trackSolution.ID][id] : null); }
public bool DeleteTrackSolution(TrackSolution trackSolution) { return(NativeMethods.mta_tracksolution_delete(_nativeHandle, trackSolution.ID)); }
/// <summary> /// Request a modifier to change a TrackSolution configuration /// </summary> /// <param name="trackSolution"> /// Instance to be updated/changed /// </param> /// <exception cref="MylapsException"> /// Throws an exception whenever it failes to create a TrackSolutionModifier instance /// </exception> /// <remarks> /// To commit the changes, use MTA.CommitChanges() /// </remarks> public TrackSolutionModifier UpdateTrackSolution(TrackSolution trackSolution) { var p = NativeMethods.mta_tracksolution_update(_nativeHandle, trackSolution.ID); return(AddTrackSolutionModifier(p)); }