G
Guest
Hello.
I need to implement the publish/subscribe architecture where class B
(server) does not have a reference to class A (which is in a client), but
class B still has to subscribe to the event raised by the class A.
Here's the problem: Class A implements the interface IClient that is on the
server, everything's fine. When the method Foo of the class A is executed,
the event is raised, passing SomeData as a reference. Now, in order to
subscribe to the event from the server, I need to do something like this:
Foo f = new Foo();
IClient icl = f as IClient();
and then:
icl.SomeEvent += new ... bla, bla...
but I DO NOT HAVE a reference to class A, method Foo, which is the whole
point from the very beginning. Is there another way to subscribe to the event
that is wrapped in the interface without having to know the class that's
implementing it on the client side?
Thanks.
I need to implement the publish/subscribe architecture where class B
(server) does not have a reference to class A (which is in a client), but
class B still has to subscribe to the event raised by the class A.
Here's the problem: Class A implements the interface IClient that is on the
server, everything's fine. When the method Foo of the class A is executed,
the event is raised, passing SomeData as a reference. Now, in order to
subscribe to the event from the server, I need to do something like this:
Foo f = new Foo();
IClient icl = f as IClient();
and then:
icl.SomeEvent += new ... bla, bla...
but I DO NOT HAVE a reference to class A, method Foo, which is the whole
point from the very beginning. Is there another way to subscribe to the event
that is wrapped in the interface without having to know the class that's
implementing it on the client side?
Thanks.