Exemple #1
0
        public void AddControl(IScriptAction action)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            _controlHandlers[action.GetType()](this, action);
        }
Exemple #2
0
        /// Add action to the code
        public void Add(IScriptAction action)
        {
            string methodId;

            for (int n = 0; ; ++n)
            {
                if (string.IsNullOrEmpty(action.Id))
                {
                    methodId = "_" + CustomAttributeHelper.First <XsTypeAttribute>(action.GetType()).Name;
                }
                else
                {
                    methodId = action.Id;
                }
                if (n != 0)
                {
                    methodId += n;
                }
                if (!_methodNames.ContainsKey(methodId))
                {
                    _methodNames[methodId] = true;
                    break;
                }
            }
            if (action is Script || methodId == action.Id || action is Sub)
            {
                Methods.Add(action);
            }
            else
            {
                Sequence b = new Sequence {
                    Id = methodId
                };
                b.Add(action);
                Methods.Add(b);
                Value += Environment.NewLine + "{ object __ret=" + methodId + "_inline(); if (__ret!=null) return __ret;}";
            }
        }
Exemple #3
0
 /// Add action to the code
 public void Add(IScriptAction action)
 {
     string methodId;
     for (int n = 0; ; ++n)
     {
         if (string.IsNullOrEmpty(action.Id))
             methodId = "_" + CustomAttributeHelper.First<XsTypeAttribute>(action.GetType()).Name;
         else
             methodId = action.Id;
         if (n != 0)
             methodId += n;
         if (!_methodNames.ContainsKey(methodId))
         {
             _methodNames[methodId] = true;
             break;
         }
     }
     if (action is Script || methodId==action.Id || action is Sub)
     {
         Methods.Add(action);
     }
     else
     {
         Sequence b = new Sequence { Id = methodId };
         b.Add(action);
         Methods.Add(b);
         Value += Environment.NewLine + "{ object __ret=" + methodId + "_inline(); if (__ret!=null) return __ret;}";
     }
 }
Exemple #4
0
        public void AddControl(IScriptAction action)
        {
            if (action == null)
                throw new ArgumentNullException("action");

            _controlHandlers[action.GetType()](this, action);
        }