/// <see cref="UISpriteManagerBase.CloseRenderContext"/> public override void CloseRenderContext(UISprite sprite) { if (this.ObjectDisposed) { throw new ObjectDisposedException("XnaSpriteManager"); } lock (this.lockObj) { XnaSprite target = (XnaSprite)sprite; if (!this.renderContexts.ContainsKey(target)) { throw new UIException("The given sprite doesn't have active render context!"); } XnaSpriteRenderContext targetContext = this.renderContexts[target]; this.renderContexts.Remove(target); targetContext.Close(); TraceManager.WriteAllTrace("XnaSpriteManager.CloseRenderContext: Render context for sprite closed", XnaTraceFilters.INFO); } }
/// <see cref="UISpriteManagerBase.CreateRenderContext_i"/> protected override IUIRenderContext CreateRenderContext_i(UISprite sprite) { if (this.ObjectDisposed) { throw new ObjectDisposedException("XnaSpriteManager"); } lock (this.lockObj) { XnaSprite target = (XnaSprite)sprite; if (this.renderContexts.ContainsKey(target)) { throw new UIException("The given sprite has already an active render context!"); } XnaSpriteRenderContext targetContext = new XnaSpriteRenderContext(target, this); this.renderContexts.Add(target, targetContext); TraceManager.WriteAllTrace("XnaSpriteManager.CreateRenderContext: Render context for sprite created", XnaTraceFilters.INFO); return(targetContext); } }