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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -