File Browsing Issue

File Browsing Issue

Post by Ian Stevenso » Sun, 02 Mar 2003 03:27:19



Hi All,

I want to build an application that displays small parts of the windows file
system in a treeview.

First I want to check if anyone knows a way of populating a TreeView with a
file system list?  You could do this with certain components in straight
Win32 but I can't find a Windows Forms solution.  I know how to fill in the
tree using DirectoryInfo and FileInfo, I just thought there might be a
quicker way!

My second question is a little more technical.  I want to use a
FileSystemWatcher object to ensure that this view is up-to-date (important
for allowing Drag'n'Drop etc).  My problem is how do I initialise the view
in a safe manner.  Heres some pseudocode to explain, illustrating the
problem:

Example A
-----------
InitialiseTreeViewFromFS( "C:\A")
    InitialiseTreeViewFromFS("C:\A\A")       // Called Recursively
// User deletes a file from explorer or another application
    InitialiseTreeViewFromFS("C:\A\B")       // Called Recursively
    InitialiseTreeViewFromFS("C:\A\B\A")   // Called Recursively
EnableFileSystemWatcher()
// BUG: Display never realises a file is missing

Example B
-----------
EnableFileSystemWatcher()
InitialiseTreeViewFromFS( "C:\A")
    InitialiseTreeViewFromFS("C:\A\A")       // Called Recursively
// User deletes a file from explorer or another application from C:\A\B\A
// BUG: We receive notification of the change but the treview doesn't
//           have this folders info yet so can't be updated
    InitialiseTreeViewFromFS("C:\A\B")       // Called Recursively
    InitialiseTreeViewFromFS("C:\A\B\A")   // Called Recursively

The only possible solution I can see is using approach B and queueing the
change notifications for processing after initialisation...  but it's not
very clean.

Any and all help / comments appreciated.

Ian

 
 
 

File Browsing Issue

Post by Ian Stevenso » Fri, 07 Mar 2003 00:55:51


<BUMP> No-one got any thoughts that might help me?

Quote:> Hi All,

> I want to build an application that displays small parts of the windows
file
> system in a treeview.

> First I want to check if anyone knows a way of populating a TreeView with
a
> file system list?  You could do this with certain components in straight
> Win32 but I can't find a Windows Forms solution.  I know how to fill in
the
> tree using DirectoryInfo and FileInfo, I just thought there might be a
> quicker way!

> My second question is a little more technical.  I want to use a
> FileSystemWatcher object to ensure that this view is up-to-date (important
> for allowing Drag'n'Drop etc).  My problem is how do I initialise the view
> in a safe manner.  Heres some pseudocode to explain, illustrating the
> problem:

> Example A
> -----------
> InitialiseTreeViewFromFS( "C:\A")
>     InitialiseTreeViewFromFS("C:\A\A")       // Called Recursively
> // User deletes a file from explorer or another application
>     InitialiseTreeViewFromFS("C:\A\B")       // Called Recursively
>     InitialiseTreeViewFromFS("C:\A\B\A")   // Called Recursively
> EnableFileSystemWatcher()
> // BUG: Display never realises a file is missing

> Example B
> -----------
> EnableFileSystemWatcher()
> InitialiseTreeViewFromFS( "C:\A")
>     InitialiseTreeViewFromFS("C:\A\A")       // Called Recursively
> // User deletes a file from explorer or another application from C:\A\B\A
> // BUG: We receive notification of the change but the treview doesn't
> //           have this folders info yet so can't be updated
>     InitialiseTreeViewFromFS("C:\A\B")       // Called Recursively
>     InitialiseTreeViewFromFS("C:\A\B\A")   // Called Recursively

> The only possible solution I can see is using approach B and queueing the
> change notifications for processing after initialisation...  but it's not
> very clean.

> Any and all help / comments appreciated.

> Ian


 
 
 

1. Browsing the file system and getting the path to a file

I am looking for is a control that returns a file path, not an opened
stream or something, like OpenFileDialog does. For instance, I click a
browse button and something like the openFileDialog pops up, then I
browse to a particular file, click ok and then it provides me with the
full path to the file I selected.

Am I missing something? How do I achieve this?

2. Dual boot Win2k w/2 drives both as C:

3. client side browsing files not file

4. My order was fine but it took a while

5. Build and browse issues

6. Abort on data transfer at &387F.... whatever

7. Disabling the file browsing capability in IE

8. Sharing Folders

9. How do I get a file browse button in the property grid?

10. FolderBrowser browse for file

11. PropertyGrid file browsing

12. PropertyGrid and Browse for File

13. 2 questions - concerning directory & file browsing