Exemple #1
0
        private T GetScreen <T>(Window window) where T : AppScreen
        {
            var @class      = new Class(typeof(T));
            var screenClass = new ScreenClass(@class);

            return((T)screenClass.New(window, this));
        }
        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);
        }
Exemple #3
0
        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;
        }