Пример #1
0
        static internal IObject CreateCommandModel(ClassFactory classFactory, CommandAdapter commandModelAdapter)
        {
            Type parameterType = GetType(classFactory, commandModelAdapter.GetParameterTypeInfo());
            Type resultType    = GetType(classFactory, commandModelAdapter.GetResultTypeInfo());
            Type commandType   = typeof(Command <, ,>).MakeGenericType(typeof(CommandState), parameterType, resultType);

            return(ActivateObjectInstance(classFactory, commandModelAdapter, commandType));
        }
Пример #2
0
 public Command(CommandAdapter adapter, ClassFactory classFactory) :
     base(adapter, classFactory)
 {
     LazyPropertyModelAdapter = new Lazy <ObservableObjectAdapter>(() =>
     {
         return(new ObservableObjectAdapter(this.Adapter.CastTo(ObservableObjectAdapter.Type)));
     });
 }
Пример #3
0
        static internal IObject CreateFactoryObject(ClassFactory classFactory, ObjectAdapter objectAdapter)
        {
            CommandAdapter commandModelAdapter = objectAdapter as CommandAdapter;

            if (commandModelAdapter != null)
            {
                return(CreateCommandModel(classFactory, commandModelAdapter));
            }
            AsyncOperationAdapter asyncOperationAdapter = objectAdapter as AsyncOperationAdapter;

            if (asyncOperationAdapter != null)
            {
                return(CreateAsyncOperation(classFactory, asyncOperationAdapter));
            }

            ObservableCollectionAdapter collectionModelAdapter = objectAdapter as ObservableCollectionAdapter;

            if (collectionModelAdapter != null)
            {
                return(CreateCollectionModel(classFactory, collectionModelAdapter));
            }

            ObservableObjectAdapter propertyModelAdapter = objectAdapter as ObservableObjectAdapter;

            if (propertyModelAdapter != null)
            {
                return(new ObservableObject(propertyModelAdapter, classFactory));
            }

            ObjectDispatchAdapter propertyDataAdapter = objectAdapter as ObjectDispatchAdapter;

            if (propertyDataAdapter != null)
            {
                return(new ObjectDispatch <ObjectDispatchAdapter>(propertyDataAdapter, classFactory));
            }

            return(new Object <ObjectAdapter>(objectAdapter));
        }