bool WasInterrupted { get; set; }
Property WasInterrupted As Boolean
Get
Set
property bool WasInterrupted {
bool get ();
void set (bool value);
}
abstract WasInterrupted : bool with get, set
This method is usable only in .NET code that is invoked in a call from the Wolfram Language, as described in Part 1 of the .NET/Link User Guide. In other words, it is only used in code that is called from a Wolfram Language session via the "installable .NET" mechanism. Programmers who are launching the kernel and controlling it from a .NET program will have no use for this method.
The IKernelLink object on which this method will be called will probably be obtained via the StdLink.Link property.When the user tries to interrupt a Wolfram Language computation that is in the middle of a call into .NET, the interrupt request is sent to .NET. If a .NET method makes no attempt to honor interrupt requests, then after the method call completes .NET/Link will execute the the Wolfram Language function Abort[], causing the entire Wolfram Language computation to end and return the result $Aborted. If you want to detect interrupts within a .NET method, for example to break out of a long .NET computation, call WasInterrupted to determine if an interrupt request has been received. If it returns true, then you can simply return from your method, and .NET/Link will take care of calling Abort[] for you. If your method returns a value, the value will be ignored. For example, you could put code like the following into a time-intensive loop you were running:
IKernelLink ml = StdLink.Link;
if (ml.WasInterrupted)
return;
IKernelLink ml = StdLink.Link;
if (ml.WasInterrupted) {
ml.BeginManual();
ml.Put("Interrupted at iteration " + i);
ml.WasInterrupted = false;
return;
}