dotnet jscript:
Hello everyone.
When testing the Jscript.NET on the .NET 2.0 Beta 2 (JScript
8.00.50215), I found an older example, with a FileSystemWatcher thread
example.
below is the example
// ----- file 'watcher.js' -----
import System.Threading;
import System.IO;
// Placeholder class to hold the delegate (callback)
class Delegates {
static function Handler(o : Object, e : FileSystemEventArgs) {
print(e.FullPath);
// Stop when a file including the word "quit" is created
if (e.FullPath.indexOf("quit") >= 0) {
keepGoing = false;
}
}
static function Main() {
// Create the directory listener
var w : FileSystemWatcher = new FileSystemWatcher("c:\\temp",
"*.txt");
// Add the event handler (ignore compiler warning)
w.add_Created(Handler);
//w.Enabled = true;
// Sleep a while and see if it is time to quit
while(keepGoing)
Thread.Sleep(500);
}
}
// Start off a new thread to keep the process alive
var keepGoing = true;
new Thread(Delegates.Main).Start();
// ----- Command Line -----
Well, this was supposed to give a warning message for the "add_Created"
part. It now doesn't, although it complains about w.Enabled o existent.
HOWEVER, on the last line, "new Thread(Delegates.Main).Start();" I get
the following compiler error:
JS1184: More than one constructor matches this argument list
I looked in the error descriptions, but I can't figure out why this
happens. Any help would be appreciated.
Also, below is the link to the older message( where I got the source
code from)
http://groups.google.com/group/microsoft.public.dotnet.languages.jscript/browse_thread/thread/6688cf1e3ad718e1/65de20cfd1fe3fa7?q=new+Thread(Delegates.Main).Start();&rnum=1&hl=en#65de20cfd1fe3fa7
Regards,
Andrei