Hi
I Previously asked a related question but I am now able to boil it down to a very simple example.
Se original quesion here: http://forum.mibuso.com/discussion/67448/net-event-handling-server-client-callback-error-when-opening-page-41-42#latest
So to keep things simpler, I have taken the liberty and created a new question.
If I listen to a .net event . e.g and for simplicity - when changes to a file occur i a folder. The fired event will never allow interaction with the GUI. And I would like to know, if I somehow can achieve this !?
To reproduce:
Here is sample code:
Best regards
Søren Lund
I Previously asked a related question but I am now able to boil it down to a very simple example.
Se original quesion here: http://forum.mibuso.com/discussion/67448/net-event-handling-server-client-callback-error-when-opening-page-41-42#latest
So to keep things simpler, I have taken the liberty and created a new question.
If I listen to a .net event . e.g and for simplicity - when changes to a file occur i a folder. The fired event will never allow interaction with the GUI. And I would like to know, if I somehow can achieve this !?
To reproduce:
- Create a codeunit (and run it in a context where the object doesn't go out of scope before tests can be done)
- Create a dotnet variable of type System.io.filesystemwatcher (set withevents to true)
- check what GUIALLOWED return on e.g. the oncreated event.
Here is sample code:
Documentation() OnRun() MyFileWatcher := MyFileWatcher.FileSystemWatcher(); MyFileWatcher.Path := 'C:\WatchThis'; MyFileWatcher.EnableRaisingEvents := TRUE; MESSAGE('Ready to test'); LOCAL TriggerThis(inputMsg : Text) MESSAGE(inputMsg); IF(GUIALLOWED) THEN MESSAGE('GUI allowed') ELSE MESSAGE('GUI not allowed') MyFileWatcher::Changed(sender : Variant;e : DotNet "System.IO.FileSystemEventArgs") TriggerThis(e.FullPath); MyFileWatcher::Created(sender : Variant;e : DotNet "System.IO.FileSystemEventArgs") TriggerThis(e.FullPath); MyFileWatcher::Deleted(sender : Variant;e : DotNet "System.IO.FileSystemEventArgs") TriggerThis(e.FullPath); MyFileWatcher::Error(sender : Variant;e : DotNet "System.IO.ErrorEventArgs") TriggerThis(e.ToString()); MyFileWatcher::Renamed(sender : Variant;e : DotNet "System.IO.RenamedEventArgs") TriggerThis(e.FullPath); MyFileWatcher::Disposed(sender : Variant;e : DotNet "System.EventArgs") TriggerThis(e.ToString());
Best regards
Søren Lund