RE: RunScript

#1

Hi, I can see from the LeapYear example that what appear to be C# scripts can be run. Like so (taken straight from the example:

using System;
(context , currentactivity) => 
{    int y=Convert.ToInt32(${Year});
       if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0))
        {
            return (string) "leap year";
        }  
        else
        {
            return (string) "Not leap year";
        }
 }

Although this seems straightforward, it is scripted and not compiled, as if perhaps it were being run with CS-Script - but not quite! I would like to know some do’s and don’ts for scripting of this kind. For example, this (although it is not useful) works (just substitute it in the Leap Year example):

using System;
using System.Windows.Forms;
(context , currentactivity) => 
{    int y=Convert.ToInt32(${Year});
       if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0))
        {
            System.Windows.MessageBox.Show("It is in fact ..");
            return (string) "leap year";
        }  
        else
        {
            return (string) "Not leap year";
        }
 }

So, at least I know we can call other .NET dlls in the scripts, including System.Windows.Forms!
Regards,
burque505

EDIT: Okay, I have one rule I know I need to follow. The code path must return a value. Like so:

using System;
using System.Windows.Forms;
(context , currentactivity) => 
{    
	System.Windows.Forms.MessageBox.Show("Hello, Zappy!");
	return (bool) false;
}

Try this without the return value and see what happens. The only activity in this workflow is a RunScript activity.
SWF