Beispiel #1
0
 private void playListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (PlayController.PlayIndex != playListBox.SelectedIndex)
     {
         PlayController.PlayIndex = playListBox.SelectedIndex;
         PlayController.PlayMusic();
     }
 }
Beispiel #2
0
        public void AddFileAndPlay(string path)
        {
            Song song = PlayController.Songs.FirstOrDefault(s => s.FileUrl.Replace(" ", "") == path);

            if (song == null)
            {
                XmlDocument xmlDoc = InitXml();
                XmlNode     root   = xmlDoc.SelectSingleNode("SongList");
                song = new Song(path, CommonProperty.getTitleFromPath(path));
                ReadInfoFromFile(song);
                root.AppendChild(CreateElement(xmlDoc, song));
                PlayController.Songs.Add(song);
                xmlDoc.Save(XmlListPath);
            }
            playListBox.ScrollIntoView(song);
            playListBox.SelectedValue = song;
            PlayController.PlayMusic(playListBox.SelectedIndex);
        }
Beispiel #3
0
        /// <summary>
        /// 应用程序响应键盘按下事件,并判断做出相关动作。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            Key downKey = e.Key;

            switch (downKey)
            {
            case Key.Space:
                if (PlayController.bassEng.CanPlay)
                {
                    PlayController.Play();
                }
                else
                {
                    PlayController.PlayMusic();
                }
                break;

            case Key.Left:
                PlayController.PlayPrevent();
                break;

            case Key.Right:
                PlayController.PlayNext();
                break;

            case Key.Up:
                PlayController.bassEng.Volume += 0.1;
                break;

            case Key.Down:
                PlayController.bassEng.Volume -= 0.1;
                break;

            default: break;
            }
        }
Beispiel #4
0
 private void btn_Play(object sender, EventArgs e)
 {
     PlayController.PlayMusic();
 }