M
Mark
What I want to do is call a function in my main form/class from the
server (which the another program/client calls). The main form does
not really create a server object so I can't pass the frmForm class
into the constructor of MyServer (the client side would have no idea
what to pass into that anyways). What other way to do this is there?
I guess there is static functions, but I can't make everything in
those functions static.
namespace Mark
{
public class frmForm : System.Windows.Forms.Form
{
private void frmForm_Load(object sender, System.EventArgs e)
{
HttpChannel channel = new HttpChannel(8001); //Create a new
channel
ChannelServices.RegisterChannel (channel); //Register channel
RemotingConfiguration.RegisterWellKnownServiceType(typeof (MyServer),"MyServer",WellKnownObjectMode.Singleton);
}
public void Function1()
{
//do some non-static stuff here
}
}
public class MyServer: MarshalByRefObject
{
public void CalledByClient()
{
//want to call frmForm.Function1 here
}
}
}
server (which the another program/client calls). The main form does
not really create a server object so I can't pass the frmForm class
into the constructor of MyServer (the client side would have no idea
what to pass into that anyways). What other way to do this is there?
I guess there is static functions, but I can't make everything in
those functions static.
namespace Mark
{
public class frmForm : System.Windows.Forms.Form
{
private void frmForm_Load(object sender, System.EventArgs e)
{
HttpChannel channel = new HttpChannel(8001); //Create a new
channel
ChannelServices.RegisterChannel (channel); //Register channel
RemotingConfiguration.RegisterWellKnownServiceType(typeof (MyServer),"MyServer",WellKnownObjectMode.Singleton);
}
public void Function1()
{
//do some non-static stuff here
}
}
public class MyServer: MarshalByRefObject
{
public void CalledByClient()
{
//want to call frmForm.Function1 here
}
}
}