Helper class responsible for creating and managing the GraphicsDevice. All GraphicsDeviceControl instances share the same GraphicsDeviceService, so even though there can be many controls, there will only ever be a single underlying GraphicsDevice. This implements the standard IGraphicsDeviceService interface, which provides notification events for when the device is reset or disposed.
Inheritance: IGraphicsDeviceService
 /// <summary>
 /// Disposes the control.
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     if (this.graphicsDeviceService != null)
     {
         this.graphicsDeviceService.Release(disposing);
         this.graphicsDeviceService = null;
     }
     base.Dispose(disposing);
 }
		/// <summary>
		/// Gets a reference to the singleton instance.
		/// </summary>
		public static GraphicsDeviceService AddRef(IntPtr windowHandle,
												   int width, int height)
		{
			// Increment the "how many controls sharing the device" reference count.
			if (Interlocked.Increment(ref referenceCount) == 1)
			{
				// If this is the first control to start using the
				// device, we must create the singleton instance.
				singletonInstance = new GraphicsDeviceService(windowHandle,
															  width, height);
			}

			return singletonInstance;
		}
        /// <summary>
        /// Initializes the control.
        /// </summary>
        protected override void OnCreateControl()
        {
            // Don't initialize the graphics device if we are running in the designer.
            if (!DesignMode)
            {
                this.graphicsDeviceService = GraphicsDeviceService.AddRef(Handle,
                                                                          ClientSize.Width,
                                                                          ClientSize.Height);
                // Register the service, so components like ContentManager can find it.
                this.services.AddService<IGraphicsDeviceService>(this.graphicsDeviceService);

                // Give derived classes a chance to initialize themselves.
                this.Initialize();
            }

            base.OnCreateControl();
        }