.NET/Link API Version 1.5 USE FRAMES

MathKernel.HandleEvents Property

Gets or sets whether the the thread on which Compute is called should continue to handle application events during the period that Compute is waiting for the result.

[Visual Basic]
Public Property HandleEvents As Boolean
public bool HandleEvents {get; set;}


Compute will not return until the Mathematica computation is finished. If you are calling Compute on your application's user-interface thread (this is typically the case, such as if you call Compute in a button-click handler), then if the HandleEvents property is set to false your application will not be responsive to user input until Compute returns. Users will not be able to click buttons, type text, or even drag the application window. You probably don't want this, which is why the default is true.

When HandleEvents is set to true, you must prevent users from triggering a call to Compute while another such call is currently in progress. One way to do this is to disable any means of triggering computations as soon as one is started, such as by disabling a "Compute" button once it has been clicked. Another possibility is to have your event handler methods check the IsComputing property and not call Compute if that property gives true.

If you go ahead and try to make a reentrant call to Compute, an InvalidOperationException will be thrown by the reentrant call to Compute.

The event handling is implemented via a Yield event handler that calls the .NET Framework method Application.DoEvents.

See Also

MathKernel Class | Wolfram.NETLink Namespace | Compute | IsComputing