//播放视频或打开文件
        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo info = this.listView1.HitTest(e.X, e.Y);

            if (info.Item != null)
            {
                string url       = info.Item.Name;
                string extension = url.Substring(url.LastIndexOf(".") + 1,
                                                 url.Length - url.LastIndexOf(".") - 1);
                string name = System.IO.Path.GetFileNameWithoutExtension(url);
                if (extension == "mp4" || extension == "avi" || extension == "mkv")
                {
                    Video        video = new Video(name, url);
                    List <Video> lists = new List <Video>();
                    foreach (string movieurl in videos)
                    {
                        string moviename = System.IO.Path.GetFileNameWithoutExtension(movieurl);
                        Video  v         = new Video(moviename, movieurl);
                        lists.Add(v);
                    }
                    PlayerForm player = new PlayerForm(video, lists, imageList1.Images);
                    player.Show();
                }
                else
                {
                    Process.Start(url);
                }
            }
        }
Exemple #2
0
        private void ListView1_MouseDoubleClick(object sender, MouseEventArgs e)//进行播放
        {
            ListViewHitTestInfo info = this.listView1.HitTest(e.X, e.Y);

            if (info.Item != null)
            {
                string       url   = info.Item.Name;
                string       name  = System.IO.Path.GetFileNameWithoutExtension(url);
                Video        video = new Video(name, url);
                List <Video> lists = new List <Video>();
                foreach (string movieurl in videoNames)
                {
                    string moviename = System.IO.Path.GetFileNameWithoutExtension(movieurl);
                    Video  v         = new Video(moviename, movieurl);
                    lists.Add(v);
                }
                PlayerForm player = new PlayerForm(video, lists, imageList1.Images);
                player.Show();
                player.AddtoLike += AddLike;
                service.UpdateTime(name, DateTime.Now);
            }
        }