Esempio n. 1
0
        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);
        }
        // 从文件中扫描视频
        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);
                    }
                }
            }
        }
Esempio n. 3
0
        //扫描磁盘中所有磁盘文件
        private void Button2_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);

            List <string> lists  = service.GetVideoList();//为扫描获得的视频建立一个列表
            int           listid = lists.Count + 1;

            int       nullNum  = 1;
            string    listname = "未命名列表" + nullNum;
            VideoList newList  = new VideoList(listid, listname);

            while (!service.AddVideoList(newList))
            {
                nullNum++;
                listname     = listname.Substring(0, listname.Length - 1) + nullNum;
                newList.Name = listname;
            }
            listBox1.Items.Add(listname);

            foreach (string s in imageFiles)
            {
                if (s != null)
                {
                    service.AddFile(s);
                    service.UpdateFileList(s, listid);
                }
            }
        }