void Deserialize(object serializedUI) { if (serializedUI == null) { return; } UIContext.Deserialize(serializedUI); var uiel = UIContext.FocusedElement as UIElement ?? UIContext.UIObject as UIElement; if (uiel == null || uiel.IsVisible) { return; } int uiContextVersionTmp = uiContextVersion; new OnVisibleHelper(uiel, () => { if (uiContextVersionTmp == uiContextVersion) { UIContext.Deserialize(serializedUI); } }); }