private static void OnGraphicsResourcesRecreate(bool recreate) { bool flag = !recreate; if (flag) { UIRenderDevice.PrepareForGfxDeviceRecreate(); } Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; UIRRepaintUpdater expr_32 = current.Value.GetUpdater(VisualTreeUpdatePhase.Repaint) as UIRRepaintUpdater; RenderChain renderChain = (expr_32 != null) ? expr_32.renderChain : null; if (recreate) { if (renderChain != null) { renderChain.AfterRenderDeviceRelease(); } } else if (renderChain != null) { renderChain.BeforeRenderDeviceRelease(); } } bool flag2 = !recreate; if (flag2) { UIRenderDevice.FlushAllPendingDeviceDisposes(); } else { UIRenderDevice.WrapUpGfxDeviceRecreate(); } }