power management - XNA application crashed after hibernate -
i create simple xna fullscreen application. if active , system goes sleep mode or hibernate mode after resume application crashed. how can solve problem?
upd: added handler system message
public game() { systemevents.powermodechanged += onpowerchange; this.graphics.preferredbackbufferwidth = 1920; this.graphics.preferredbackbufferheight = 1080; this.graphics.preferredbackbufferformat = surfaceformat.bgr565; this.graphics.isfullscreen = true; } void onpowerchange(object sender, powermodechangedeventargs e) { switch (e.mode) { case powermodes.suspend: graphics.preferredbackbufferwidth = 800; graphics.preferredbackbufferheight = 600; graphics.togglefullscreen(); graphics.applychanges(); break; } }
if application in window mode, onpowerchange() work fine , change resolusion 1920x1080 800x600. if application fullscreen mode, method not called. also, runtime error here
static void main(string[] args) { using (game game = new game()) { game.run(); } }
error is: cannot access disposed object. object name: 'windowsgameform'.
Comments
Post a Comment