public void nextPlay(MenuItem item) { this.musicMenu.playingIndex = (this.musicMenu.playingIndex + 1) % (this.musicMenu.getItemSize() - 4); string name = this.musicMenu.getItemByIndex(this.musicMenu.playingIndex).Name; MusicFile file = MusicFileService.Instance().FindFile(name); if (cm != null) { cm.StopT(); } cm = new clsMCI(); cm.FileName = file.Path; cm.play(); this.musicMenu.Show(); }
static void previousPlay(MenuItem item) { int size = musicMenu.getItemSize() - 4; musicMenu.playingIndex = (musicMenu.playingIndex + size - 1) % size; string name = musicMenu.getItemByIndex(musicMenu.playingIndex).Name; MusicFile file = MusicFileService.Instance().FindFile(name); if (cm != null) { cm.StopT(); } cm = new clsMCI(); cm.FileName = file.Path; cm.play(); musicMenu.Show(); }
//播放音乐 public void playMusic(MenuItem item) { //歌曲播放选中 this.musicMenu.playingIndex = item.Id; //MessageBox.Show("播放音乐"+item.Name); MusicFile file = MusicFileService.Instance().FindFile(item.Name); if (null == file) { this.musicMenu.Show(); return; } //停止旧的歌曲 if (null != cm) { cm.StopT(); } //播放 cm = new clsMCI(); cm.FileName = file.Path; cm.play(); }