public static GraphicsDeviceService AddRef(IntPtr windowHandle, int width, int height) { if (Interlocked.Increment(ref referenceCount) == 1) { SingletonInstance = new GraphicsDeviceService(windowHandle, width, height); } return SingletonInstance; }