Esempio n. 1
0
        private void addListButton_Click(object sender, EventArgs e)
        {
            List <String> lists = service.GetVideoList();

            if (lb.Items.Contains(listnameText.Text))
            {
                MessageBox.Show("列表已存在!");
            }
            else
            {
                VideoList newList = new VideoList(lists.Count + 1, listnameText.Text);
                if (service.AddVideoList(newList))
                {
                    lb.Items.Add(listnameText.Text);
                    MessageBox.Show("添加成功!");
                }
                else
                {
                    MessageBox.Show("添加失败!");
                }
            }
        }
Esempio n. 2
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);
                }
            }
        }