private void ApplyStyles(string screenName, ILayoutable scr, object cache) { string cssFile = null; var sheet = scr as ICustomStyleSheet; if (sheet != null) { if (!string.IsNullOrEmpty(sheet.StyleSheet)) { cssFile = sheet.StyleSheet; } } TimeStamp.Start("Init styles"); IStyleSheet styleSheet = InitStyles(screenName, cssFile); styleSheet.SetCache((IDisposable)cache); TimeStamp.Log("Init styles"); TimeStamp.Start("Assign styles"); styleSheet.Assign(scr); TimeStamp.Log("Assign styles"); TimeStamp.Start("Apply styles"); scr.ApplyStyles(styleSheet, StyleSheetContext.Current.EmptyBound, StyleSheetContext.Current.EmptyBound); TimeStamp.Log("Apply styles"); }