B
bivoauc
I am currently working with the System.Addin system. I have created my plugin
and everything is working but I am having a problem with one thing I wish to
do. It is easy to have the host send items to the Addin Assembly, but how can
I send messages from the Plugin Assembly.
I tried adding a Register Method to my Interface and Implementing in on the
Plugin side.
void RegisterMessenger(IMessenger messenger);
-- IMessenger
public interface IMessenger
{
void WriteMessage(string message);
}
[Serializable]
public class SimpleMessenger : IMessenger
{
public void WriteMessage(string msg)
{
Console.Writeline(msg);
}
}
Then on the host after activating my Token I would then register my
messenger with the plugin
== host ==
SimpleMessenger sm = new SimpeMessenger();
MyAddin myaddin = token.Activate<MyAddin>(AddInSecurityLevel.FullTrust);
myaddin.RegisterMessenger(sm);
== Addin ==
[AddIn("MyAddin", Version="1.0")]
public class MyAddin : MyContract
{
public void RegisterMessenger(IMessenger msg)
{
msg.WriteMessage("Plugins RegisterMessenger called");
}
}
That is not all of the code but the Idea on how I tried send messages back
to the host which did not work. Is there an easy way built in to the
System.Addin framework to do this? If not then how should I go about this. I
know there is Remoting , which I am not familiar with. I also looked at
sending messages through the XDMessaging library, but this will eventually
be a web app. Any help on this would be appreciated.
and everything is working but I am having a problem with one thing I wish to
do. It is easy to have the host send items to the Addin Assembly, but how can
I send messages from the Plugin Assembly.
I tried adding a Register Method to my Interface and Implementing in on the
Plugin side.
void RegisterMessenger(IMessenger messenger);
-- IMessenger
public interface IMessenger
{
void WriteMessage(string message);
}
[Serializable]
public class SimpleMessenger : IMessenger
{
public void WriteMessage(string msg)
{
Console.Writeline(msg);
}
}
Then on the host after activating my Token I would then register my
messenger with the plugin
== host ==
SimpleMessenger sm = new SimpeMessenger();
MyAddin myaddin = token.Activate<MyAddin>(AddInSecurityLevel.FullTrust);
myaddin.RegisterMessenger(sm);
== Addin ==
[AddIn("MyAddin", Version="1.0")]
public class MyAddin : MyContract
{
public void RegisterMessenger(IMessenger msg)
{
msg.WriteMessage("Plugins RegisterMessenger called");
}
}
That is not all of the code but the Idea on how I tried send messages back
to the host which did not work. Is there an easy way built in to the
System.Addin framework to do this? If not then how should I go about this. I
know there is Remoting , which I am not familiar with. I also looked at
sending messages through the XDMessaging library, but this will eventually
be a web app. Any help on this would be appreciated.