Example #1
0
        /// <summary>
        /// 메세지 큐, 노래 추가되면 목록에 추가
        /// </summary>
        private void ExecuteMessage()
        {
            try
            {
                while (true)
                {
                    while (playListQueue.Count > 0)
                    {
                        string songName = playListQueue.Dequeue();
                        BasePlayListCollection.Add(new PlayList()
                        {
                            index         = BasePlayListCollection.Count,
                            name          = songName,
                            playCommand   = this.playCommand,
                            deleteCommand = this.deleteCommand
                        });
                    }

                    Controller.Reset();
                    Controller.WaitOne(Timeout.Infinite);
                }
            }

            catch { }
        }
        /// <summary>
        /// 이전곡으로 넘기기 버튼
        /// </summary>
        public void BeforeSongExecuteCommand()
        {
            if (audio != null)
            {
                int beforeIndex = BasePlayListCollection.FirstOrDefault(e => e.name == title).index - 1;

                // 만약 현재 재생곡이 처음 노래였다면
                // 마지막 곡으로 보낸다.
                if (beforeIndex < 0)
                {
                    beforeIndex = BasePlayListCollection.Count - 1;
                }

                EnqueueNowPlay(BasePlayListCollection[beforeIndex].name);
            }
        }
        /// <summary>
        /// 다음곡으로 넘기기 버튼
        /// </summary>
        public void NextSongExecuteCommand()
        {
            if (audio != null)
            {
                int nextIndex = BasePlayListCollection.FirstOrDefault(e => e.name == title).index + 1;

                // 만약 마지막 노래 재생이 끝난 상황이라면
                // 처음 곡으로 돌려보낸다.
                if (nextIndex == BasePlayListCollection.Count)
                {
                    nextIndex = 0;
                }

                EnqueueNowPlay(BasePlayListCollection[nextIndex].name);
            }
        }