Click here to Skip to main content
15,919,132 members
Home / Discussions / C#
   

C#

 
AnswerRe: Clear buffer Pin
leppie9-Mar-06 4:34
leppie9-Mar-06 4:34 
GeneralRe: Clear buffer Pin
hung_ngole9-Mar-06 4:52
hung_ngole9-Mar-06 4:52 
Questionwhere to download Longhorn SDK Pin
Sheel Gohe9-Mar-06 3:27
Sheel Gohe9-Mar-06 3:27 
AnswerRe: where to download Longhorn SDK Pin
gnjunge9-Mar-06 3:35
gnjunge9-Mar-06 3:35 
Questiondelegate thru an interface Pin
spin vector9-Mar-06 3:17
spin vector9-Mar-06 3:17 
AnswerRe: delegate thru an interface Pin
leppie9-Mar-06 4:42
leppie9-Mar-06 4:42 
GeneralRe: delegate thru an interface Pin
spin vector9-Mar-06 5:02
spin vector9-Mar-06 5:02 
GeneralRe: delegate thru an interface Pin
vineas9-Mar-06 8:26
vineas9-Mar-06 8:26 
I think he's confused about your use of the word interface - he's thinking of an interface such as IDisposable, or ISerializable (though obviously defined by you), and it sounds like you mean interface as object layer that hides the engine.

Off the top of my head, I can think of two ways to do this:

1) Cascading events - When the interface is loaded, it subscribes to events in the engine. When the user connects to the interface, it then subscribes to events in the interface. When the engine raises the event, the interface gets notified to it's handler. It then raises the event the user subscribed to.

These cascading events will work, though performance may be a concern to you. It wasn't in an app I'm working on (at least in this area), and the events needed to be bubbled up quite a few layers, with each layer doing something with the event, so this mechanism worked fairly well.

2) Have a method defined in your interface that takes in a delegate as a parameter of the correct delegate type to the event you want to subscribe to. This interface method will use this delegate to subscribe to the engine event. When the engine raises the event, the user is notified without the interface getting in the way.

<br />
// in interface<br />
public void ConnectEvent(EventHandler h)<br />
{<br />
  engine->TheEvent += h;<br />
}<br />
<br />
...<br />
// in user<br />
  interface->ConnectEvent(new EventHandler(user_EventHandler));<br />


I did something like this a while ago, but I don't remember why or how well it worked out.

-----
In the land of the blind, the one eyed man is king.
QuestionHow to get window's size and position to javascript? Pin
jzb9-Mar-06 3:05
jzb9-Mar-06 3:05 
QuestionBreakPoint Pin
Areff9-Mar-06 2:29
Areff9-Mar-06 2:29 
AnswerRe: BreakPoint Pin
Dan Neely9-Mar-06 3:03
Dan Neely9-Mar-06 3:03 
GeneralRe: BreakPoint Pin
Areff9-Mar-06 19:58
Areff9-Mar-06 19:58 
Questionsocket programming Pin
eey569-Mar-06 0:52
eey569-Mar-06 0:52 
QuestionRe: socket programming Pin
Divyang Mithaiwala9-Mar-06 2:50
Divyang Mithaiwala9-Mar-06 2:50 
AnswerRe: socket programming Pin
eey569-Mar-06 3:20
eey569-Mar-06 3:20 
GeneralRe: socket programming Pin
Divyang Mithaiwala9-Mar-06 4:10
Divyang Mithaiwala9-Mar-06 4:10 
GeneralRe: socket programming Pin
eey569-Mar-06 10:20
eey569-Mar-06 10:20 
AnswerRe: socket programming Pin
eey569-Mar-06 3:17
eey569-Mar-06 3:17 
QuestionWhat C# compiler does? Pin
Chandana Subasinghe9-Mar-06 0:40
Chandana Subasinghe9-Mar-06 0:40 
AnswerRe: What C# compiler does? Pin
leppie9-Mar-06 4:33
leppie9-Mar-06 4:33 
QuestionMultiThreading Pin
AB77719-Mar-06 0:24
AB77719-Mar-06 0:24 
GeneralRe: MultiThreading Pin
Steve Hansen9-Mar-06 0:42
Steve Hansen9-Mar-06 0:42 
GeneralRe: MultiThreading Pin
AB77719-Mar-06 1:07
AB77719-Mar-06 1:07 
GeneralRe: MultiThreading Pin
lmoelleb9-Mar-06 20:58
lmoelleb9-Mar-06 20:58 
QuestionHow to Show Only Images in "HtmlInputFile" Dialog ??? Pin
Abubakarsb8-Mar-06 23:47
Abubakarsb8-Mar-06 23:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.