Esempio n. 1
0
 //Event handler for updating user's status
 private void UpdateUserStatus(object sender, AudioItemEventArgs e)
 {
     if (_ToStatus)
     {
         ApiAudio.SetBroadcast(e.Audio.OwnerId.ToString() + "_" + e.Audio.Id.ToString(), new long[] { UserId });
     }
 }
Esempio n. 2
0
        private void SomeSongDown(object sender, AudioItemEventArgs e)
        {
            var audio = e.Audio;

            this.Log(MessageStatus.Info, LogStrings.Info.Audio.Player.PrecacheDone + GetAudioFileName(audio));

            DBInsert(DBTable.Audio, new object[] { audio.Id, audio.OwnerId, audio.Artist, audio.Title, audio.Duration, audio.LyricsId });

            if (_ApiPlayer.PlaybackState != PlaybackState.Paused)
            {
                if (_ApiPlayer.PlaybackState == PlaybackState.Stopped)
                {
                    Play();
                }
                if (audio == _AwaitingSong)
                {
                    Play();
                    _AwaitingSong = null;
                }
            }
            if (ActionAvaibility != null)
            {
                bool prevAvaible = false;
                if (_CurrentSongIndex != 0)
                {
                    if (System.IO.File.Exists(Environment.CurrentDirectory + Constants.CacheDirAudioSuffix + "\\" + GetAudioFileName(_PlayList[_CurrentSongIndex - 1])))
                    {
                        prevAvaible = true;
                    }
                }
                bool nextAvaible = false;
                if (_CurrentSongIndex != _PlayList.Count - 1)
                {
                    if (System.IO.File.Exists(Environment.CurrentDirectory + Constants.CacheDirAudioSuffix + "\\" + GetAudioFileName(_PlayList[_CurrentSongIndex + 1])))
                    {
                        nextAvaible = true;
                    }
                }
                ActionAvaibility(this, new ActionAvaibilityEventArgs(nextAvaible, prevAvaible));
            }
        }