The C# sample runs as expected, displaying 'Started. Finished.', but the ipy
does nothing.
Can someone enlighten me as to the difference? I assume it is something to
do with the way functions are represented in ipy vs. what methodinvoker is
looking for,
but I'm honestly lost.
C#:
class foo
{
public void start()
{
Console.WriteLine("Started.");
Thread.Sleep(2000);
}
public void finish(IAsyncResult r)
{
Console.WriteLine("Finished.");
}
}
class Program
{
static void Main(string[] args)
{
foo bar = new foo();
MethodInvoker mi = new MethodInvoker(bar.start);
mi.BeginInvoke(new AsyncCallback(bar.finish), null);
Console.ReadLine();
}
}
IPY:
import clr
clr.AddReferenceByPartialName('System.Windows.Forms')
from System import AsyncCallback
from System.Threading import Thread
from System.Windows.Forms import MethodInvoker
class foo:
def start(self):
print 'Started.'
Thread.Sleep(2000)
def finish(self, r):
print 'Finished.'
bar = foo()
mi = MethodInvoker(bar.start)
mi.BeginInvoke(AsyncCallback(bar.finish), None)
___________________________
Matthew Barnard
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com