Hi.
I have this console based Asynchronous VS project that works fine.
And then i have a remoting project which also works fine. I want to edit the remoting project so it is non-blocking, using asynchronous calls.
I´ve tried different examples, but I cant get it to work. None of them seems to call my callback method back.
Here is the relevant snippets:
The remote object:
....
public class MultiContainer : MarshalByRefObject, IMultiContainer
{
public string GetClientsList()
{
Thread.Sleep(1000);
return Program.ServerForm.GetClientsList();
}
....
The client which accesses the remote object with asyn call:
namespace Client
{
public partial class Form1 : Form
{
Server.IMultiContainer mc;
private delegate string Delegate();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
mc = new Server.MultiContainer();
Delegate del = new Delegate(mc.GetClientsList);
AsyncCallback callback = new AsyncCallback(Callback);
del.BeginInvoke(callback, null);
}
private void Callback(IAsyncResult ar)
{
//this callback method is never called...
Delegate del = (Delegate)((AsyncResult)ar).AsyncDelegate;
richTextBox1.Text = del.EndInvoke(ar);
}
...
Been sitting with this problem for hours, hope you can help!
Thanks alot :)