Embedding IronPython in a WinForms app and interrupting execution
- by namenlos
BACKGROUND
I've successfully embedded IronPython in my WinForm apps using techniques like the one described here: http://blog.peterlesliemorris.com/archive/2010/05/19/embedding-ironpython-into-a-c-application.aspx
In the context of the embedding, my user may any write loops, etc.
I'm using the IronPython 2.6 (the IronPython for .NET 2.0 and IronPython for .NET 4.0)
MY PROBLEM
Sometimes the users will need to interrupt the execution of their code
In other words they need something like the ability to hit CTRL-C to halt execution when running Python or IronPython from the cmdline
I want to add a button to the winform that when pressed halts the execution, but I'm not sure how to do this.
MY PROBLEM
The users will need to interrupt the execution of their code
In other words they need something like the ability to hit CTRL-C to halt execution when running Python or IronPython from the cmdline
MY QUESTION
How can I make it to that pressing the a "stop" button will actually halt the execution of the using entered IronPython code?
NOTES
Note: I don't wont to simply through away that "session" - I still want the user to be able to interact with session and access any results that were available before it was halted.
I am assuming I will need to execute this in a separate thread, any guidance or sample code in doing this correctly will be appreciated.