Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

GUIALLOWED False for .net events e.g System.io.Filesystemwatcher.

$
0
0
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:
  1. Create a codeunit (and run it in a context where the object doesn't go out of scope before tests can be done)
  2. Create a dotnet variable of type System.io.filesystemwatcher (set withevents to true)
  3. 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

Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>