public void Play()
        {
            if (!hasPlayedOnce)
            {
                CurrentSound = SoundFileTimePairs[0].SoundFile;
                CurrentSound.PlaySound(false, false, true);
                CurrentSound.Sound.PlayPosition = CurrentSound.GetRandomPlayPosition();
                CurrentSound.Sound.Paused       = false;
                UpdateRadioLengthWithCurrentSound();
                hasPlayedOnce = true;

                UpdateWheelInfo();
            }
            else
            {
                if (!allSoundsPlayedOnce &&
                    lastPlayedSoundIndex == SoundFileTimePairs.Count - 1)
                {
                    allSoundsPlayedOnce = true;
                }

                ResumeContinuity();
            }

            Function.Call(Hash.SET_AUDIO_FLAG, "DisableFlightMusic", true);
            Function.Call(Hash.SET_AUDIO_FLAG, "DisableWantedMusic", true);
        }
        private void PlayNextSound()
        {
            int currentSoundIndex = 0;

            if (CurrentSound != null)
            {
                currentSoundIndex = SoundFileTimePairs.IndexOf(SoundFileTimePairs.Find(s => s.SoundFile == CurrentSound));
                CurrentSound.StopSound();
            }

            // Set next in list
            currentSoundIndex = currentSoundIndex < SoundFileTimePairs.Count - 1 ? currentSoundIndex + 1 : 0;

            CurrentSound = SoundFileTimePairs[currentSoundIndex].SoundFile;
            CurrentSound.PlaySound(true);
            UpdateRadioLengthWithCurrentSound();
            UpdateWheelInfo();
            UpdateTrackUpdateTimer();
        }
        private void ResumeContinuity()
        {
            uint elapsed = (uint)(DateTime.Now - lastPlayedTime).TotalMilliseconds;

            var lastPlayedSound = SoundFileTimePairs[lastPlayedSoundIndex].SoundFile;

            //UI.ShowSubtitle("allSoundsPlayed: " + allSoundsPlayedOnce +
            //    "\nelapsed ms: " + elapsed +
            //    "\nRemaining playtime: " + (lastPlayedSound.Length - stoppedPositionSound));

            if (allSoundsPlayedOnce)
            {
                uint newPlayPos = GetTimeFromPrevious(stoppedPositionStation, TotalLength, elapsed);
                var  stPair     = SoundFileTimePairs.LastOrDefault(s => newPlayPos >= s.StartTime);
                CurrentSound = stPair != default(SoundFileTimePair) ? stPair.SoundFile : SoundFileTimePairs[0].SoundFile;
                CurrentSound.PlaySound(true, false, true);
                UpdateRadioLengthWithCurrentSound();
                CurrentSound.Sound.PlayPosition = Math.Max(0, newPlayPos - stPair.StartTime);
                CurrentSoundIsPaused            = false;
            }
            else if (elapsed < lastPlayedSound.Length - stoppedPositionSound)
            {
                CurrentSound = SoundFileTimePairs[lastPlayedSoundIndex].SoundFile;
                CurrentSound.PlaySound(true, false, true);
                CurrentSound.Sound.PlayPosition = Math.Min(CurrentSound.Length - 1, stoppedPositionSound + elapsed);
                CurrentSoundIsPaused            = false;
                UpdateRadioLengthWithCurrentSound();
            }
            else
            {
                CurrentSound = lastPlayedSoundIndex != SoundFileTimePairs.Count - 1 ?
                               SoundFileTimePairs[lastPlayedSoundIndex + 1].SoundFile : SoundFileTimePairs[0].SoundFile;
                CurrentSound.PlaySound(true);
                UpdateRadioLengthWithCurrentSound();
            }

            UpdateWheelInfo();
            if (CurrentSound.HasTrackList)
            {
                UpdateTrackUpdateTimer();
            }
        }