[IronPython] Need a Good Embedded Example
joesox at gmail.com
Thu Oct 18 06:53:04 PDT 2007
On 10/17/07, Joshua J. Pearce <joshua.pearce at gmail.com> wrote:
> OK, please forgive my earlier vagueness. What I want to do is as follows:
> pe = PythonEngine.CurrentEngine;
> //create a instance of my applications business logic layer class
> myAppService = new AppService(_token);
> //I want to be able to somehow make methods from the myAppService class
> available to be called from Iron Python code.
> //I know I could import the AppService dll and create my own instance in the
> IP engine, but that's way too much overhead.
> //How can I say: "Hey, pe, here is a method on my object, myAppService, that
> I want you to make available when you execute a command?
What are the return values of myAppService.ServiceMethod()?
Depending upon these values, you will need to handle them before
sending them to the pe.
So it sounds like you need something like:
public int COUNT;
private void MyIPGetCount()
//Call your Service method and assign return value to a global
COUNT = myAppService.getcount();
//Create variable bridge from C# to IronPython engine
//I like to pretend I am just using a IP command line to help
figure out what I need to do
pe.ExecuteCommand("PyCount = 0");
//Set the IronPython bridge variables...
pe.ExecuteCommand("PyCountTwo = PyCount");
This is a simplified version of what I am guess what you need to do
but there you go.
More information about the Users