示例#1
0
 public NonGenericCommandFactory(
     ICommandFactory commandFactory,
     IViewModel viewModel,
     CommandMethods methods)
 {
     this.viewModel      = viewModel;
     this.methods        = methods;
     this.commandFactory = commandFactory;
 }
示例#2
0
 public GenericCommandFactory(
     ICommandFactory commandFactory,
     INotifyPropertyChanged viewModel,
     CommandMethods methods,
     Type parameterType)
 {
     this.viewModel      = viewModel;
     this.methods        = methods;
     this.parameterType  = parameterType;
     this.commandFactory = commandFactory;
 }
示例#3
0
		public ICommand Create(INotifyPropertyChanged viewModel, CommandMethods methods)
		{
			if (methods.HasErrors)
			{
				return null;
			}

			var parameter = methods.ActionMethod.MethodInfo.GetParameters().SingleOrDefault();

			var factory =
				parameter.IsNull() ?
					new NonGenericCommandFactory(commandFactory, viewModel, methods) :
					(IFactory<ICommand>)new GenericCommandFactory(commandFactory, viewModel, methods, parameter.ParameterType);

			return factory.Create();
		}
示例#4
0
        public ICommand Create(IViewModel viewModel, CommandMethods methods)
        {
            if (methods.HasErrors)
            {
                return(null);
            }

            var parameter = methods.ActionMethod.MethodInfo.GetParameters().SingleOrDefault();

            IFactory <ICommand> factory;

            if (parameter.IsNull())
            {
                factory = nonGenericCommandFactory(viewModel, methods);
            }
            else
            {
                factory = genericCommandFactory(viewModel, methods, parameter.ParameterType);
            }

            return(factory.Create());
        }