public virtual object New(Window window, ScreenRepository screenRepository)
        {
            var o = Activator.CreateInstance(type, window, screenRepository);
            //Get all fields, even from base types
            var fieldInfos = AllTypes(type).SelectMany(t => t.GetFields(Entity.BindingFlag));

            foreach (var fieldInfo in fieldInfos)
            {
                if (nonInjectedTypes.Any(t => t.IsAssignableFrom(fieldInfo.FieldType)))
                {
                    continue;
                }

                object injectedObject = null;
                if (typeof(IUIItem).IsAssignableFrom(fieldInfo.FieldType))
                {
                    var interceptor = new UIItemInterceptor(SearchCondition(fieldInfo, window.Framework), window, screenRepository.SessionReport);
                    injectedObject = DynamicProxyGenerator.Instance.CreateProxy(fieldInfo.FieldType, interceptor);
                }
                else if (typeof(AppScreenComponent).IsAssignableFrom(fieldInfo.FieldType))
                {
                    var componentScreenClass = new ScreenClass(fieldInfo.FieldType);
                    injectedObject = componentScreenClass.New(window, screenRepository);
                }

                if (injectedObject != null)
                {
                    fieldInfo.SetValue(o, injectedObject);
                }
            }

            return(o);
        }
        public virtual object New(Window window, ScreenRepository screenRepository)
        {
            object o = @class.New(window, screenRepository);

            @class.EachField(delegate(FieldInfo fieldInfo)
            {
                if (nonInjectedTypes.IsAssignableFrom(fieldInfo.FieldType))
                {
                    return;
                }
                object injectedObject = null;
                if (typeof(IUIItem).IsAssignableFrom(fieldInfo.FieldType))
                {
                    var interceptor = new UIItemInterceptor(SearchCondition(fieldInfo), window, screenRepository.SessionReport);
                    injectedObject  = DynamicProxyGenerator.Instance.CreateProxy(interceptor, fieldInfo.FieldType);
                }
                else if (typeof(AppScreenComponent).IsAssignableFrom(fieldInfo.FieldType))
                {
                    var componentScreenClass = new ScreenClass(new Class(fieldInfo.FieldType));
                    injectedObject           = componentScreenClass.New(window, screenRepository);
                }

                if (injectedObject != null)
                {
                    fieldInfo.SetValue(o, injectedObject);
                }
            });
            return(o);
        }