IScriptCommand getPropertyCommand = 
  ScriptCommands.AssignValueConverter(ValueConverterType.GetProperty, "{Converter}", 
    ScriptCommands.Reassign("{Variable1}", "{Converter}", "{Variable2}", false, 
	  ScriptCommands.PrintDebug("{Variable1} -> {Variable2}")), "DayOfWeek");
			
IScriptCommand executeMethodCommand = 
  ScriptCommands.AssignValueConverter(ValueConverterType.ExecuteMethod, "{Converter}", 
    ScriptCommands.Reassign("{Variable1}", "{Converter}", "{Variable2}", false, 
	  ScriptCommands.PrintDebug("{Variable1} + 1 day -> {Variable2}")), "AddDays", 1);				  
			
IScriptCommand getItemInArrayCommand = 
  ScriptCommands.AssignValueConverter(ValueConverterType.GetArrayItem, "{Converter}", 
    ScriptCommands.Reassign("{Array}", "{Converter}", "{DestVariable}", false, 
	  ScriptCommands.PrintDebug("Item 1 -> {DestVariable}")), 1);	

await ScriptRunner.RunScriptAsync(new ParameterDic() { 
                { "Variable1", DateTime.Now },
            }, getPropertyCommand);

await ScriptRunner.RunScriptAsync(new ParameterDic() { 
                { "Variable1", DateTime.Now },
            }, executeMethodCommand);	  
	  
await ScriptRunner.RunScriptAsync(new ParameterDic() { 
                { "Array", new [] { 1,2,3} },
            }, getItemInArrayCommand);


Output :
29/07/2014 6:05:20 PM -> Tuesday
29/07/2014 6:05:20 PM + 1 day -> 30/07/2014 6:05:20 PM
Item 1 -> 2

Last edited Jul 29, 2014 at 11:06 AM by lycj, version 1

Comments

No comments yet.