void XnaWindowHost_Loaded(object sender, RoutedEventArgs e) { // If we don't yet have a GraphicsDeviceService reference, we must add one for this control if (graphicsService == null) { graphicsService = GraphicsDeviceService.AddRef(hWnd, (int)ActualWidth, (int)ActualHeight); // Invoke the LoadContent event if (LoadContent != null) { LoadContent(this, new GraphicsDeviceEventArgs(graphicsService.GraphicsDevice)); } } }
bool InitGraphicsDevice() { // If we don't yet have a GraphicsDeviceService reference, we must add one for this control if (graphicsService == null || graphicsService.GraphicsDevice == null || graphicsService.GraphicsDevice.IsDisposed) { graphicsService = GraphicsDeviceService.AddRef(hWnd, (int)ActualWidth, (int)ActualHeight); // Invoke the LoadContent event if (LoadContent != null) { LoadContent(this, new GraphicsDeviceEventArgs(graphicsService.GraphicsDevice)); } return(true); } return(false); }