c# - How would you go about detecting events defined by libraries in other classes? -
so i'm working sdldotnet - converts sdl calls c# should , ran issue.
that issue being because sdldotnet running in different class main part of application - can't detect when it's closing.
the sdldotnet library has event fires when told close, , event is:
sdldotnet.core.events.quit   in object viewer - event shown such:
public static event system.eventhandler<quiteventargs> quit member of sdldotnet.core.events   what i've done, there main windows form application calls upon sdl class so:
private void drawtoscreen() {     //starts sdl off drawing screen     sdldraw sdl = new sdldraw();     sdl.startdrawing();      //how go detecting sdldotnet.events.quit     //from class i've instanced      //when on original windows forms implementation     //it worked this:      ////sdl.formclosed += new formclosedeventhandler(detectclose);      //but copying structure , trying      ////sdl.events.quit += new quitargs(detectclose);      //doesn't have same effect, because sdl not contain definition 'events' } private void detectclose(object sender, quitargs e) {     messagebox.show("sdl closed!") }   so, guess question how listen events.quit firing in class called class called from?
thanks in advance!
the declaration reveals static event, therefore associated class, not instance. use
sdldotnet.core.events.quit += new quitargs(detectclose);      
Comments
Post a Comment