   [SlimDx] - Game Loop and Disposing
  Hi,somehow Ive gotten into a state when my form doesnt close anymore. And I was wondering if anyone can spot what Im doing wrong?In my Program.cs I have:using(var form = new Form1())  { form.Run(); Console.Out.WriteLine("Finished");  }In my Form1.cs I have:public void Run()   {  this.Closed += (o, args) => { isFormClosed = true;};  MessagePump.Run(this, ()=>   {  if (isFormClosed) return;    Render();   });   }But my form never closes. The lambda is fired when I click on the close button. But the MessagePump continues to loop. The form stays active despite repeatedly clicking the close button.How do I get out of the message pump loop. And at what point should I start disposing of my objects? Edit: Fixed code blocks[Edited by - lucasite on May 19, 2010 2:57:39 AM]