// 从文件中扫描视频 private void addVideoButton_Click(object sender, EventArgs e) { FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.Description = "请选择文件路径"; if (dialog.ShowDialog() == DialogResult.OK) { Path = dialog.SelectedPath; MessageBox.Show("已选择文件夹:" + Path, "选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } List <string> imageFiles = new List <string>(); imageFiles = GetFile.GetVideo(Path, imageFiles); foreach (string s in imageFiles) { if (s != null) { if (listBox1.SelectedIndex != 1) { service.AddVideosToList(s, ListID); videos = service.GetFileFromList(ListID); ListViewUpdate(videos); ListViewUpdate(ListID); listBox1.SelectedIndex = 0; } else { service.AddFile(s); List <string> allVideos = service.GetAllVideos(); ListViewUpdate(allVideos); } } } }
private void addVideosButton_Click(object sender, EventArgs e) { List <string> ListID = service.GetVideoList(ListName); string listId = ListID[0]; FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.Description = "请选择文件路径"; if (dialog.ShowDialog() == DialogResult.OK) { Path = dialog.SelectedPath; MessageBox.Show("已选择文件夹:" + Path, "选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } List <string> imageFiles = new List <string>(); imageFiles = GetFile.GetVideo(Path, imageFiles); foreach (string s in imageFiles) { if (s != null) { service.AddVideosToList(s, listId); } } List <string> videos = service.GetFileFromList(listId); ListViewUpdate(videos); }