예제 #1
0
        public override Reply Run <T>(ControlsStorage <T> controls, IDictionary <string, dynamic> args)
        {
            CheckParamExists(args, "element_id");
            CheckValidControlId <T>(args["element_id"], controls);

            object            c     = controls.GetControl(args["element_id"]);
            DynamicValueReply reply = new DynamicValueReply(c.GetType().Name);

            return(reply);
        }
예제 #2
0
        protected void CheckValidControlId <T>(dynamic id, ControlsStorage <T> controls)
            where T : class
        {
            if (id < 0)
            {
                throw new ErrorReplyException(ErrorCodes.INVALID_VALUE, "invalid element id (should be >= 0)");
            }
            if (controls != null)
            {
                if (id < 1)
                {
                    throw new ErrorReplyException(ErrorCodes.INVALID_VALUE, "invalid element id (should be >= 1)");
                }

                if (controls.GetControl(id) == null)
                {
                    throw new ErrorReplyException(ErrorCodes.NOT_FOUND, "element not found with ID: " + id);
                }
            }
        }
예제 #3
0
 public abstract Reply Run <T>(ControlsStorage <T> controls, IDictionary <string, dynamic> args)
     where T : class;