private void SendTrackEvent(TrackPlayingEvent tpe)
        {
            bool Lock = _LockEvent;

            MusicTrackEventArgs tre = null;

            if (PrivateTrackEvent != null)
            {
                tre = (tpe == TrackPlayingEvent.BeginPlay) ? new MusicTrackEventArgs(_TrackSource, tpe, MaxPosition) : new MusicTrackEventArgs(_TrackSource, tpe);
                PrivateTrackEvent(this,tre);
            }

            if (tre == null)
            {
                tre = (tpe == TrackPlayingEvent.BeginPlay) ? new MusicTrackEventArgs(_TrackSource, tpe, MaxPosition) : new MusicTrackEventArgs(_TrackSource, tpe);
            }

            if (!Lock)
                _TrackEvent.Fire(tre, true);
        }
 public MusicTrackEventArgs(ITrack track, TrackPlayingEvent what)
 {
     Track = track;
     What = what;
     TotalDuration = null;
 }
 public MusicTrackEventArgs(ITrack track, TrackPlayingEvent what,TimeSpan duration)
 {
     Track = track;
     What = what;
     TotalDuration = duration;
 }
 internal static void ShouldRaiseTrackEvent(this MusicPlayer @this, ITrack tr, TrackPlayingEvent tpe)
 {
     @this.ShouldRaise("TrackEvent").WithSender(@this).WithArgs<MusicTrackEventArgs>(e => e.Track == tr && tpe == e.What);
 }