Class similar to FileSystemWatcher

aruangra

Member
Licensed User
Longtime User
Hello all

I would like to detect a new file created in a directory. In VB, there is the FileSystemWatcher class to do the job. How can I do this in Basic4PPC?

Thank you.

Anat
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no equivalent functionality in Basic4ppc (nor in the .Net Compact Framework).

If you can settle with checking the files about once every minute or more then you can use FileSearch to add the files to a Hashtable. After the first time, every file that FileSearch finds and is not found in the Hashtable you can consider as a new file.
 

aruangra

Member
Licensed User
Longtime User
Erel

The class is available in OpennetCF.
FileSystemWatcher Class
I have two questions:

1. Is it possible to add OpenNETCF.dll as a component and use the FileSystemWatcher class in Basic4PPC?

2. What kind of DLL libraries can Basic4PPC use? Can I use any other library developed for VB in Basic4PPC?

Thanks,
Anat
 

agraham

Expert
Licensed User
Longtime User
1. Is it possible to add OpenNETCF.dll as a component and use the FileSystemWatcher class in Basic4PPC?
No. Amongst other reasons Basic4ppc doesn't implement delegates and can't access the types declared in the dll.
2. What kind of DLL libraries can Basic4PPC use?
.NET Assemblies whose classes' constructors, methods and properties use strings or primitive value types. For events to work the library must implement the Basic4ppc event convention.
Can I use any other library developed for VB in Basic4PPC?
If you mean already written libraries then possibly but fairly unlikely. If you mean ones specially written in VB then yes. I've had a look at the FileSystemWatcher code and, unlike some other bits of OpenNETCF, it looks like a fairly easy job to implement as a Basic4ppc library if there was enough demand to warrant the effort.
 
Top