Communication between two AddIns

Tags: 

Hi,

I have two Workspace AddIns - AddIn1 => Button and AddIn2 => Button. I coded two addins in two different classes under same Solution and able to view as different addins in the Insert Control section of Workspace.

How can I achieve the functionality of sending text or content from Button of AddIn1 to Textbox of AddIn2?Any ideas appreciated....

Thanks,
Suresh

Comments

Hi Suresh,

you can make the receiving Addin a Signleton class. Below an example;

namespace Addin1Namespace
{
public sealed partial class ReceivingAddin : UserControl
{
private static readonly Lazy<ReceivingAddin> _instance =
new Lazy<ReceivingAddin>(() => new ReceivingAddin());

public static ReceivingAddin Instance { get { return _instance.Value; } }

public void SayHello()
{
MessageBox.Show("Hello");
}
}
}

You now can call the hello function from a different addin like;

ReceivingAddin.Instance.SayHello();

Don't forget to add the receiving addin class as a reference to the calling class!

Bastiaan

Zircon - This is a contributing Drupal Theme
Design by WeebPal.