创建“虚拟目录”或树视图,以便用户可以浏览数据库中存在的文件
我知道我可以使用 FileDialog 浏览文件(当文件存在时)。我正在跟踪目录中所做的更改,每次发生更改时我都会将该文件保存在数据库中。我记录文件路径、修改日期、输入数据库的日期以及用于标识每个文件的文件 ID。
所以我的数据库包含一个很大的文件列表(大约 50,000 个)。当我浏览文件时,我将该文件列表放置在列表视图中。如果我想恢复文件,我必须浏览该列表视图,这并不难,因为我添加了搜索功能来过滤结果。
但我想让用户能够像在 Windows 中一样浏览该文件。换句话说,您必须双击列表视图中的文件夹才能查看其内容。我设法通过创建一个事件来做到这一点,当您双击列表视图中的文件夹时,它只会显示文件的父目录是双击的目录。换句话说,通过双击文件夹,您将看到该目录的内容。这种技术的唯一问题是速度慢。每次双击文件夹大约需要 2 秒。开始时速度很快,但往往会变慢。如果我能加快这个过程就好了。我对文件进行了排序以加快此过程并创建一个循环而不是查询,但这仍然需要时间。
或者也许我必须修改我的数据库以加快此过程。由于我正在跟踪大量更改,因此我希望数据库尽可能小。但如果我必须添加几列才能完成这项工作,那么我会修改它。
I know I can browse through files when they exist by using a FileDialog. I am tracking the changes that are made in a directory and every time there has been a change I save that file in a database. I record the file path, date modified, date entered to the database and a file id to identify each file.
So my database contains a big list of files (about 50,000). When I browse through a file I place that list of files in a listview. If I want to recover a file I would have to browse through that listview which is not hard because I have added a search feature in order to filter results.
But I would like to enable the user to browse through the file just as you would do it in Windows. In other words you would have to double click a folder in the listview to see its contents. I managed to do that by creating an event that when you double click a folder in the listview it will just show the files which parent directory is the one that has been double clicked. In other words by double clicking a folder you will see the contents of that directory. The only problem with this technique is that it is slow. Every time double click on a folder it takes about 2 seconds. At the begining it is fast but it tends to slow down. It would be nice if I could speed up this process. I have sorted the files to speed up this process and create a loop instead of a query but it still takes time.
Or maybe I have to modify my database to speed up this process. Since I am tracking a lot of changes I would like the database to be as small as possible. But if I have to add a few columns to make this work then I'll modify it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这听起来像是我使用 sharepoint(2010 年基金会,免费)文档库所做的事情。也许是一个选择?
This sounds like something i'd do with sharepoint (2010 foundation, it's free) document libraries. Maybe an option?