/// <summary> /// 清空播放列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pic_clear_Click(object sender, EventArgs e) { EV9000List list = new EV9000List(); List <EV9000List> EVlist = new List <EV9000List>(); for (int i = 0; i < this.Controls.Count; i++) { if (this.Controls[i].GetType().FullName.Equals(list.GetType().FullName)) { Console.WriteLine(this.Controls[i].GetType().FullName); EVlist.Add((EV9000List)this.Controls[i]); } } foreach (EV9000List lctr in EVlist) { this.Controls.Remove(lctr); } this.filelist.Clear(); }
/// <summary> /// 添加文件到播放列表 /// </summary> /// <param name="filepath"></param> public void AddFileToPlayList(String filepath) { try { bool isExist = false; foreach (EV9000List list in filelist) { if (list.Tag.Equals(filepath)) { isExist = true; break; } } if (!isExist) { EV9000List file = new EV9000List(); file.Select += new EVENTHander(this.Select); file.DBClick += new EVENTHander(this.DBClick); file.MouseScroll += new MouseEventHandler(EV9000PlayList_MouseWheel); file.KeyPressDown += new KeyEVENTHander(this.EV9000PlayList_KeyDown); file.Tag = filepath; file.filepath = filepath; this.filelist.Add(file); file.setFilePath(filepath); IsShowScrollBar(); if (IsshowScrollBar) { file.Size = new Size(this.Size.Width - this.pic_up.Size.Width - 1, 48); } else { file.Size = new Size(this.Size.Width - 1, 48); } file.Location = new Point(1, (filelist.Count - 1) * 50); this.Controls.Add(file); } } catch (Exception ew) { iev9000player.m_log.writeRunErrorMsg("在调用函数[AddFileToPlayList(" + filepath + ")]发生异常,异常原因:" + ew.Message); } }
/// <summary> /// 设置当前正在播放的 /// </summary> /// <param name="filepath"></param> public void SetCurrentPlayFile(String filepath) { EV9000List list = new EV9000List(); for (int i = 0; i < this.Controls.Count; i++) { if (this.Controls[i].GetType().FullName.Equals(list.GetType().FullName)) { EV9000List lctr = (EV9000List)this.Controls[i]; if (lctr.Tag.Equals(filepath)) { lctr.SetCurrentPlay(); } else { lctr.SetNotSelect(); } } } }
/// <summary> /// 删除播放列表文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pic_remove_Click(object sender, EventArgs e) { EV9000List list = new EV9000List(); List <EV9000List> EVlist = new List <EV9000List>(); for (int i = 0; i < this.Controls.Count; i++) { if (this.Controls[i].GetType().FullName.Equals(list.GetType().FullName)) { EV9000List lctr = (EV9000List)this.Controls[i]; if (lctr.IsSelect && !lctr.IsCurrentPlay) { EVlist.Add(lctr); } } } foreach (EV9000List lctr in EVlist) { this.Controls.Remove(lctr); this.filelist.Remove(lctr); } PlayListRefresh(0); }