Example #1
0
        private void AddIndividualOptions(TreeListNode node, List<Slyce.ITemplate.IOption> options, ScriptBase iteratorObject)
        {
            if (options.Count > 0)
            {
                TreeListNode optionsNode = treeList.AppendNode(new object[] { "Options", null, null }, node);
                optionsNode.ImageIndex = optionsNode.SelectImageIndex = (int)Images.Option;
                optionsNode.Tag = options;

                foreach (Slyce.ITemplate.IOption option in options)
                {
                    object defaultValue = null;
                    bool found = false;

                    foreach (UserOption opt in iteratorObject.UserOptions)
                    {
                        if (opt.Name == option.VariableName)
                        {
                            defaultValue = opt.Value;
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        //if (option.DefaultValueIsFunction)
                        //{
                            defaultValue = GetDefaultOptionValueFromFunction(option.DefaultValue, iteratorObject);
                        //}
                        //else
                        //{
                        //    defaultValue = option.DefaultValue;
                        //}
                        iteratorObject.AddUserOption(new ArchAngel.Providers.Database.Model.UserOption(option.VariableName, option.VarType, defaultValue));
                    }
                    if (Project.MustDisplayOptionToUser(option, iteratorObject))
                    {
                        TreeListNode optionNode = treeList.AppendNode(new object[] { option.Text, defaultValue.ToString(), null }, optionsNode);
                        optionNode.Tag = option;
                        optionNode.ImageIndex = optionNode.SelectImageIndex = (int)Images.GreenBullet;
                    }
                }
            }
        }