public void Release(bool disposing)
        {
            if (Interlocked.Decrement(ref refCount) == 0)
            {
                if (disposing)
                {
                    if (DeviceDisposing != null)
                        DeviceDisposing(this, EventArgs.Empty);

                    this.GraphicsDevice.Dispose();
                }

                this.GraphicsDevice = null;
            }
        }
        private void CreateDevice(IntPtr windowHandle, int width, int height)
        {
            parameters = new monoFrameworkAlias.Microsoft.Xna.Framework.Graphics.PresentationParameters();
            parameters.BackBufferWidth = Math.Max(width, 1);
            parameters.BackBufferHeight = Math.Max(height, 1);
            parameters.BackBufferFormat = SurfaceFormat.Color;
            parameters.DepthStencilFormat = DepthFormat.Depth24;
            parameters.DeviceWindowHandle = windowHandle;
            parameters.PresentationInterval = PresentInterval.Immediate;
            parameters.IsFullScreen = false;

            this.GraphicsDevice = new monoFrameworkAlias.Microsoft.Xna.Framework.Graphics.GraphicsDevice(
                monoFrameworkAlias.Microsoft.Xna.Framework.Graphics.GraphicsAdapter.DefaultAdapter,
                monoFrameworkAlias.Microsoft.Xna.Framework.Graphics.GraphicsProfile.Reach,
                parameters);

            if (DeviceCreated != null)
            {
                DeviceCreated(this, EventArgs.Empty);
            }
        }