I've been working on a tagging program for my computer. I need to the ability to pass a list of files or folders into an explorer (or something similar) to display them and be able to manipulate them much like you would do with a folder view in Windows.
我一直在为我的电脑做一个标记程序。我需要能够将文件或文件夹列表传递到资源管理器(或类似的东西)以显示它们,并且能够像操作Windows中的文件夹视图一样操纵它们。
I've already written the software which records and stores tags relative to file's path on the computer, and I can search through them dynamically creating a list of paths, but the next part I'm a little stumped on.
我已经编写了在计算机上记录和存储相对于文件路径的标签的软件,我可以通过它们动态创建路径列表进行搜索,但下一部分我有点难过。
Even if there is a solution where I fool the operating into thinking the files are within a "temp" folder and simply display that, that would be perfect.
即使有一个解决方案,我愚弄操作认为文件在“临时”文件夹中,只是显示,这将是完美的。
I'm written everything in C# so far, but I am not picky on the language.
到目前为止,我用C#编写了所有内容,但我并不挑剔语言。
Thanks in advance!
提前致谢!
4 个解决方案
#1
IExplorerBrowser control is the native interface for using the "Windows Explorer" control. This has been wrapped in a .NET way in Windows API Code Pack for .NET framework (http://code.msdn.microsoft.com/WindowsAPICodePack)
IExplorerBrowser控件是使用“Windows资源管理器”控件的本机接口。这已经在Windows API Code Pack for .NET框架中以.NET方式包装(http://code.msdn.microsoft.com/WindowsAPICodePack)
You could start by using that control (there is a WPF and winforms version, with events, collections you can bind to, tons of properties/flags to set, etc).
您可以从使用该控件开始(有一个WPF和winforms版本,包含事件,可以绑定的集合,要设置的大量属性/标志等)。
If that doesn't give you the desired control, you can move on to the actual Shell objects. The library above also provides access different types of Shell objects- files, folders, virtual items such as control panel, other known folders, etc. You can look at their Shell samples and see the usage.
如果这不能提供所需的控件,则可以转到实际的Shell对象。上面的库还提供访问不同类型的Shell对象 - 文件,文件夹,虚拟项目(如控制面板),其他已知文件夹等。您可以查看其Shell示例并查看用法。
In short, you can use a ListBox-like control in your app and display the types of files/folders (anything that is represented in Shell). You can also get rich information about each object, like their thumbnail/icon, properties, etc.
简而言之,您可以在应用程序中使用类似ListBox的控件,并显示文件/文件夹的类型(Shell中表示的任何内容)。您还可以获取有关每个对象的丰富信息,例如缩略图/图标,属性等。
#2
Create your own directory viewer. However, it will be quite a challenging and time/money consuming task.
创建自己的目录查看器。然而,这将是一个非常具有挑战性和时间/金钱消耗的任务。
Variant 2:
Create catalog with all your tagged tree structure (use links to all real files or just some id-s).
使用所有标记树结构创建目录(使用指向所有真实文件的链接或仅使用一些id-s)。
Show it in explorer.
在资源管理器中显示它。
Track changes in that catalog and do following changes in with your tagged data.
跟踪该目录中的更改,并对标记数据进行以下更改。
#3
Sure you could create also temporary folders containing links to your tagged files and then embedding a explorer-control in your app which you could then let navigate to "file://c/temp/mytaggedfolder" or similar but..
当然,您还可以创建包含指向标记文件的链接的临时文件夹,然后在您的应用程序中嵌入一个资源管理器控件,然后您可以导航到“file:// c / temp / mytaggedfolder”或类似文件但是..
What about simply add all data to a listView? There is lot of example code for that on codeproject for example.
如何简单地将所有数据添加到listView?例如,在codeproject上有很多示例代码。
#4
Do a search for IShellFolder and IShellView. for example: http://www.codeproject.com/KB/shell/explorer.aspx
搜索IShellFolder和IShellView。例如:http://www.codeproject.com/KB/shell/explorer.aspx
The interfaces are not especially simple to use, but not especially difficult either and they're quite powerful. from your description it sounds exactly like what you need to essentially host explorer's view within your app, point it at both the real filesystem and/or a custom namespace, and then customize/override the behavior.
接口使用起来并不是特别简单,但也不是特别困难,它们非常强大。根据您的描述,它听起来与您在应用程序中实际托管资源管理器视图所需的内容完全相同,将其指向真实文件系统和/或自定义命名空间,然后自定义/覆盖行为。
#1
IExplorerBrowser control is the native interface for using the "Windows Explorer" control. This has been wrapped in a .NET way in Windows API Code Pack for .NET framework (http://code.msdn.microsoft.com/WindowsAPICodePack)
IExplorerBrowser控件是使用“Windows资源管理器”控件的本机接口。这已经在Windows API Code Pack for .NET框架中以.NET方式包装(http://code.msdn.microsoft.com/WindowsAPICodePack)
You could start by using that control (there is a WPF and winforms version, with events, collections you can bind to, tons of properties/flags to set, etc).
您可以从使用该控件开始(有一个WPF和winforms版本,包含事件,可以绑定的集合,要设置的大量属性/标志等)。
If that doesn't give you the desired control, you can move on to the actual Shell objects. The library above also provides access different types of Shell objects- files, folders, virtual items such as control panel, other known folders, etc. You can look at their Shell samples and see the usage.
如果这不能提供所需的控件,则可以转到实际的Shell对象。上面的库还提供访问不同类型的Shell对象 - 文件,文件夹,虚拟项目(如控制面板),其他已知文件夹等。您可以查看其Shell示例并查看用法。
In short, you can use a ListBox-like control in your app and display the types of files/folders (anything that is represented in Shell). You can also get rich information about each object, like their thumbnail/icon, properties, etc.
简而言之,您可以在应用程序中使用类似ListBox的控件,并显示文件/文件夹的类型(Shell中表示的任何内容)。您还可以获取有关每个对象的丰富信息,例如缩略图/图标,属性等。
#2
Create your own directory viewer. However, it will be quite a challenging and time/money consuming task.
创建自己的目录查看器。然而,这将是一个非常具有挑战性和时间/金钱消耗的任务。
Variant 2:
Create catalog with all your tagged tree structure (use links to all real files or just some id-s).
使用所有标记树结构创建目录(使用指向所有真实文件的链接或仅使用一些id-s)。
Show it in explorer.
在资源管理器中显示它。
Track changes in that catalog and do following changes in with your tagged data.
跟踪该目录中的更改,并对标记数据进行以下更改。
#3
Sure you could create also temporary folders containing links to your tagged files and then embedding a explorer-control in your app which you could then let navigate to "file://c/temp/mytaggedfolder" or similar but..
当然,您还可以创建包含指向标记文件的链接的临时文件夹,然后在您的应用程序中嵌入一个资源管理器控件,然后您可以导航到“file:// c / temp / mytaggedfolder”或类似文件但是..
What about simply add all data to a listView? There is lot of example code for that on codeproject for example.
如何简单地将所有数据添加到listView?例如,在codeproject上有很多示例代码。
#4
Do a search for IShellFolder and IShellView. for example: http://www.codeproject.com/KB/shell/explorer.aspx
搜索IShellFolder和IShellView。例如:http://www.codeproject.com/KB/shell/explorer.aspx
The interfaces are not especially simple to use, but not especially difficult either and they're quite powerful. from your description it sounds exactly like what you need to essentially host explorer's view within your app, point it at both the real filesystem and/or a custom namespace, and then customize/override the behavior.
接口使用起来并不是特别简单,但也不是特别困难,它们非常强大。根据您的描述,它听起来与您在应用程序中实际托管资源管理器视图所需的内容完全相同,将其指向真实文件系统和/或自定义命名空间,然后自定义/覆盖行为。