コード例 #1
0
        private void 添加相关文件ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem item in this.listView1.SelectedItems)
            {
                string         itemName = item.Name;
                OpenFileDialog od1      = new OpenFileDialog();
                od1.InitialDirectory = "c:\\";
                od1.Filter           = GetFile.DocumentFilter;
                od1.FilterIndex      = 2;
                od1.RestoreDirectory = true;

                if (od1.ShowDialog() == DialogResult.OK)
                {
                    Path = od1.FileName;
                    MessageBox.Show("已选择文件:" + Path, "选择文件提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                service.BindFile(Path, ListID, itemName);
                service.AddBinding(itemName, true);
            }
            documents = service.GetDocument(ListID);
            videos    = service.GetFileFromList(ListID);
            ListViewUpdate(videos);
            ListViewUpdate(ListID);
            listBox1.SelectedIndex = 0;
        }