Search Results

Search found 1 results on 1 pages for 'hectorsosajr'.

Page 1/1 | 1 

  • Exposing C# COM server events to Delphi client applications

    - by hectorsosajr
    My question is very similar to these two: http://stackoverflow.com/questions/1140984/c-component-events http://stackoverflow.com/questions/1638372/c-writing-a-com-server-events-not-firing-on-client However, what worked for them is not working for me. The type library file, does not have any hints of events definitions, so Delphi doesn't see it. The class works fine for other C# applications, as you would expect. COM Server tools: Visual Studio 2010 .NET 4.0 Delphi applications: Delphi 2010 Delphi 7 Here's a simplified version of the code: /// <summary> /// Call has arrived delegate. /// </summary> [ComVisible(false)] public delegate void CallArrived(object sender, string callData); /// <summary> /// Interface to expose SimpleAgent events to COM /// </summary> [ComVisible(true)] [GuidAttribute("1FFBFF09-3AF0-4F06-998D-7F4B6CB978DD")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IAgentEvents { ///<summary> /// Handles incoming calls from the predictive manager. ///</summary> ///<param name="sender">The class that initiated this event</param> ///<param name="callData">The data associated with the incoming call.</param> [DispId(1)] void OnCallArrived(object sender, string callData); } /// <summary> /// Represents the agent side of the system. This is usually related to UI interactions. /// </summary> [ComVisible(true)] [GuidAttribute("EF00685F-1C14-4D05-9EFA-538B3137D86C")] [ClassInterface(ClassInterfaceType.None)] [ComSourceInterfaces(typeof(IAgentEvents))] public class SimpleAgent { /// <summary> /// Occurs when a call arrives. /// </summary> public event CallArrived OnCallArrived; public SimpleAgent() {} public string AgentName { get; set; } public string CurrentPhoneNumber { get; set; } public void FireOffCall() { if (OnCallArrived != null) { OnCallArrived(this, "555-123-4567"); } } } The type library file has the definitions for the properties and methods, but no events are visible. I even opened the type library in Delphi's viewer to make sure. The Delphi app can see and use any property, methods, and functions just fine. It just doesn't see the events. I would appreciate any pointers or articles to read. Thanks!

    Read the article

1