Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2007

Tip: Looking for answers? Try searching our database.

System.Addin , Call Host From Addin

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bivoauc - 01 Dec 2007 05:05 GMT
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.
Jialiang Ge [MSFT] - 03 Dec 2007 10:32 GMT
Hello,

From your post, my understanding on this issue is: you wonder how to send
messages, or manipulate host (If I understand it correctly), from the addin
side in the communication pipeline between Host and Add-in. If I'm off
base, please feel free to let me know.

According to the MSDN blog .NET Application Extensibility Part1, 2
http://msdn.microsoft.com/msdnmag/issues/07/02/CLRInsideOut/default.aspx?loc
=en
http://msdn.microsoft.com/msdnmag/issues/07/03/CLRInsideOut/default.aspx
there are three categories of the communication:
1.    The add-in provides a service to the host application. That is to say
Host call Add-in's method
2.    The host offers its behavior to the add-in and lets the add-in define
how it automates the host. In this scenario, the host is really providing a
service to the add-in. Most Microsoft? Office add-ins fall under this
category: upon initialization of the add-in, the Office application will
pass its root object to the add-in, allowing it to automate the host.
3.    add-ins that use the host mainly for screen real-estate rather than any
host-specific functionality

Based on my understanding of your question, I think the 2nd category fits
your request. That is to say, the add-in is able to automate the host
application, like setting data, invoking a host side event, calling a host
side method, etc. Take the Office automation as an example, Office add-ins
are able to manipulate Office documents because Office host passes its
object (Application object) to add-in, and add-in is able to operate the
host using the Application object. Therefore, in order to accomplish your
request, we need to pass the host object to the add-in with a interface
defined in Contract/Adapters/Views. When the add-in get the host object, it
can directly call host's method/event/property to set values, and so on.

Please let me know if I understand you question correctly, or if you have
any other concerns.

Regards,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Jialiang Ge [MSFT] - 05 Dec 2007 04:37 GMT
Hi,

Would you mind letting me know the result of the suggestions? If you need
further assistance, feel free to let me know. I will be more than happy to
be of assistance.

Have a great day!

Sincerely,
Jialiang Ge  (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.