void EndDraw()
{
try
{
var sourceRectangle = new Rectangle(0, 0, ClientSize.Width,
ClientSize.Height);
this.GraphicsDevice.Present(sourceRectangle, null, Handle);
}
catch
{
// Present might throw if the device became lost while we were
// drawing. The lost device will be handled by the next BeginDraw,
// so we just swallow the exception.
}
}