Description of ScriptFunction. A function in a Script
        /// <summary>
        /// Run selected script with 2/3 parameters for all rows of SQL. 
        /// If you choose isWithAsk=true
        /// </summary>
        /// <param name="model"></param>
        /// <param name="sql"></param>
        /// <param name="function"></param>
        /// <param name="isWithAsk">Ask if execute, skip script execution or break altogether</param>
        /// <returns></returns>
        public static bool RunScriptWithAsk(Model model, string sql, ScriptFunction function, bool isWithAsk = false)
        {
            string scriptName = function.Owner.Name;
            string functionName = function.Name;
            int scriptParCount = function.NumberOfParameters;

            // Check parameter count of function
            if (scriptParCount < 2 || scriptParCount > 3)
            {
                MessageBox.Show($"Function: '{scriptName}:{functionName} count of parameters={scriptParCount}", @"Count of parameters for function shall be 2 or 3 (object_type, Id, Model), Break!!!!");
                return false;
            }

            // get SQL
            string xml = model.SqlQueryWithException(sql);
            if (xml == null) return false;

            // Output the query in EA Search Window
            string target = model.MakeEaXmlOutput(xml);
            model.Repository.RunModelSearch("", "", "", target);

            // get rows / items to call function
            List<EaItem> eaItemList = model.MakeEaItemListFromQuery(XDocument.Parse(xml));
            int countCurrent = 0;
            int count = eaItemList.Count;
            foreach (EaItem item in eaItemList)
            {

                switch (scriptParCount)
                {
                    case 2:
                    case 3:
                        // run script
                        bool run = true;
                        if (isWithAsk)
                        {
                            // run the function with two or three parameters
                            DialogResult result = MessageBox.Show($"Function '{functionName}', Item {countCurrent} of {count}", @"YES=Execute,No=Skip execution, Cancel=Break,", MessageBoxButtons.YesNoCancel);
                            if (result.Equals(DialogResult.No)) run = false;
                            if (result.Equals(DialogResult.Cancel)) return false;
                        }
                        if (run)  // run script
                        {
                            countCurrent += 1;
                            if (countCurrent%20 == 0)
                                    model.Repository.WriteOutput("Script", $"{functionName}: {countCurrent} of {count}", 0);
                            if (ScriptUtility.RunScriptFunction(model, function, item.EaObjectType, item.EaObject) == false) return false;
                        }
                        continue;
                    default:
                        MessageBox.Show($"Script parameter count shall be 2 or 3, is {scriptParCount}", @"Invalid count of function parameters, Break!!!!");
                        break;

                }
            }
            return true;
        }
        /// <summary>
        /// Run function for EA item of arbitrary type<par></par>
        /// - If parameter count = 2 it calls the function with oType, oContext<par></par>
        /// - If parameter count = 3 it calls the function with oType, oContext, Model
        /// </summary>
        /// <param name="model"></param>
        /// <param name="function">Function</param>
        /// <param name="oType">EA Object type</param>
        /// <param name="oContext">EA Object</param>
        /// <returns></returns>
        public static bool RunScriptFunction(Model model, ScriptFunction function, EA.ObjectType oType, object oContext)
        {
            // run script according to parameter count
            switch (function.NumberOfParameters)
            {
                case 2:
                    object[] par2 = { oContext, oType };
                    new ScriptFuntionWrapper(function).Execute(par2);
                    return true;
                case 3:
                    object[] par3 = { oContext, oType, model };
                    return new ScriptFuntionWrapper(function).Execute(par3);
                default:
                    MessageBox.Show($"Script {function.FullName}  has {function.NumberOfParameters} parameter",
                        @"Script function parameter count not 2 or 3, Break!");
                    return false;
            }

        }
 /// <summary>
 /// Constructor Global Key Definition for a Script Function. Id="Script:Function" Name. 
 /// <para />It contains the key, ScriptFunction as Object, Description and Help.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="modifier1"></param>
 /// <param name="modifier2"></param>
 /// <param name="modifier3"></param>
 /// <param name="modifier4"></param>
 /// <param name="help"></param>
 /// <param name="scriptFunction"></param>
 /// <param name="description"></param>
 public GlobalKeysConfigScript(string key, string modifier1, string modifier2, string modifier3, string modifier4, 
         ScriptFunction scriptFunction, string description, string help)
         : base($"{scriptFunction.Owner.Name}:{scriptFunction.Name}", key, modifier1, modifier2, modifier3, modifier4, description, help)
     {
     ScriptFunction = scriptFunction;
 }
 /// <summary>
 /// Create a ServiceScript with Reference to Function and Service Parameter:
 /// <para/>ID=ScriptName:FunctionName
 /// <para/>Description=ScriptName:FunctionName  (used to display the function)
 /// <para/>Help=Function.Description            (used to show help, not description!!)
 /// </summary>
 /// <param name="function"></param>
 public ServiceScript(ScriptFunction function) : base($"{function.Owner.Name}:{function.Name}", $"{function.Owner.Name}:{function.Name}", function.Description)
 {
     Function = function;
 }
        public ScriptFuntionWrapper(ScriptFunction function, bool isErrorOutput)
        {
            _function = function;
            _isErrorOutput = isErrorOutput;

        }
 public ScriptFuntionWrapper(ScriptFunction function)
 {
     _function = function;
 }
 public ServicesConfigScript(int pos, ScriptFunction function, string buttonText)
     : base(pos, $"{function.Owner.Name}:{function.Name}", buttonText)
 {
     Function = function;
 }