public Command(String name, String[] parameters) { CommandTemplate baseTemplate = CommandTemplate.FindCommandByName(name); mTemplate = baseTemplate; LoadCommandFromTemplate(parameters, baseTemplate); }
public static CommandTemplate FindCommandByName(String name) { CommandTemplate retval = null; foreach (CommandTemplate commandTemplate in CommandTemplate.CommandSet) { if (commandTemplate.CommandName == name) { retval = commandTemplate; break; } } return(retval); }
private void LoadCommandFromTemplate(String[] parameters, CommandTemplate baseTemplate) { ParameterInstances = new ObservableCollection <ParameterInstance>(); int numberOfParameters = baseTemplate.NumberOfParameters; for (int index = 0; index < numberOfParameters; index++) { ParameterInstance inst = baseTemplate.CreateParameterInstance(index); if ((parameters != null) && (index < parameters.Length)) { inst.Value = parameters[index]; } ParameterInstances.Add(inst); } }
public Command(CommandTemplate baseTemplate) { mTemplate = baseTemplate; LoadCommandFromTemplate(null, baseTemplate); }
public ParameterInstance(CommandTemplate template, int parameterIndex) { mTemplate = template; mParameterIndex = parameterIndex; Value = ""; }