Esempio n. 1
0
 public NonGenericCommandFactory(
     ICommandFactory commandFactory,
     IViewModel viewModel,
     CommandMethods methods)
 {
     this.viewModel      = viewModel;
     this.methods        = methods;
     this.commandFactory = commandFactory;
 }
Esempio n. 2
0
 public GenericCommandFactory(
     ICommandFactory commandFactory,
     INotifyPropertyChanged viewModel,
     CommandMethods methods,
     Type parameterType)
 {
     this.viewModel      = viewModel;
     this.methods        = methods;
     this.parameterType  = parameterType;
     this.commandFactory = commandFactory;
 }
Esempio n. 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();
		}
Esempio n. 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());
        }