I have an Interface in c# in which i have declared event for example:
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("3839C631-AEDE-4535-9A28-15F4BFCA0C5A")]
public Interface Isample
{
event OnAdd(Isample sample);
}
[ClassInterface(ClassInterfaceType.None)]
[Guid("E81B32A2-B98C-48C0-A235-17771EE001D6")]
[ComVisible(true)]
public class Sample:Isample
{
//'''''''''''''''''''''
}
I want to fire this event in c# and listen it into javascript through firebreath.
Thanks in advance.
COM events are very different from C# events. They are much more generic, the event listener must implement an interface and tell the event source about it through IConnectionPoint. The event source then "raises" an event simply by calling the interface method. You thus need to:
void Add(ISample sample)
in your case.[ComSourcesInterfaces]
attribute.This MSDN article shows an example.