private void axWindowsMediaPlayer1_StatusChange(object sender, EventArgs e) { Console.WriteLine(DateTime.Now.ToString("HH时mm分ss秒 ffff") + ":" + axWindowsMediaPlayer1.status); if ("已停止" == axWindowsMediaPlayer1.status) { labelStatus.Text = "现时播放音乐:无"; FormFinishConfirm formFinishConfirm = new FormFinishConfirm(false); formFinishConfirm.StartPosition = FormStartPosition.CenterParent; formFinishConfirm.ShowDialog(); var musicLogClient = new MusicLogClient(); musicLogClient.UpdateLastOneFinishTIme(); } }
private void Listbox_MouseDoubleClick(object sender, MouseEventArgs e) { var CurrentControl = (ListBox)sender; int index = CurrentControl.IndexFromPoint(e.Location); if (index == System.Windows.Forms.ListBox.NoMatches) { CurrentControl.SelectedIndex = -1; return; } var formFinishConfirm = new FormFinishConfirm(true); formFinishConfirm.StartPosition = FormStartPosition.CenterParent; var confirmResult = formFinishConfirm.ShowDialog();// MessageBox.Show("是否确认已将音源输入切换至电脑?","切换提醒",MessageBoxButtons.OKCancel); //执行双击事件 var infoMusic = listCategory.SelectMany(c => c.MusicInfo).FirstOrDefault(a => a.Name == CurrentControl.SelectedItem.ToString()); if (null == infoMusic) { MessageBox.Show("音频文件已下架,请重新打开app"); // return; } axWindowsMediaPlayer1.URL = GetCurrentMusicDirectory() + infoMusic.CategoryInfo.Name + "\\" + infoMusic.SRC.Substring(infoMusic.SRC.LastIndexOf("/") + 1); axWindowsMediaPlayer1.settings.playCount = infoMusic.PlayTime; axWindowsMediaPlayer1.Ctlcontrols.play(); labelStatus.Text = "现时播放音乐:" + infoMusic.Name; MusicLogInfo infoMusicLog = new MusicLogInfo(); infoMusicLog.StoreID = new StoreHelper().GetLoginInfo().ID; infoMusicLog.MusicName = infoMusic.Name; infoMusicLog.CategoryName = infoMusic.CategoryInfo.Name; infoMusicLog.CreateDate = DateTime.Now; infoMusicLog.FinishConfirmTime = DicInfo.DateZone; if (infoMusicLog.StoreID > 0) { new MusicLogClient().CreateToClient(infoMusicLog); } }