示例#1
0
 public override void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver)
 {
     if (string.CompareOrdinal(methodName, "IsFileTypeValid") == 0)
     {
         if (!string.IsNullOrEmpty(returnReceiver))
         {
             code.Add(string.Format(CultureInfo.InvariantCulture, "{0}=({1}.value.split('.').pop().toLowerCase()>=0);\r\n", returnReceiver, WebPageCompilerUtility.JsCodeRef(CodeName)));
         }
     }
     else if (string.CompareOrdinal(methodName, "IsFileSizeValid") == 0)
     {
         if (!string.IsNullOrEmpty(returnReceiver))
         {
             code.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}.jsData.IsFileSizeValid();\r\n", returnReceiver, WebPageCompilerUtility.JsCodeRef(CodeName)));
         }
     }
     else if (string.CompareOrdinal(methodName, "SetMaxFileSize") == 0)
     {
         code.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.SetMaxFileSize({1});\r\n", WebPageCompilerUtility.JsCodeRef(CodeName), parameters[0]));
     }
     else
     {
         WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver);
     }
 }
示例#2
0
        public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver)
        {
            IJavascriptType ijt = this.ObjectInstance as IJavascriptType;

            if (ijt == null)
            {
                Type t = this.ObjectInstance as Type;
                if (t != null)
                {
                    if (t.GetInterface("IJavascriptType") != null)
                    {
                        ijt = Activator.CreateInstance(t) as IJavascriptType;
                    }
                }
            }
            if (ijt != null)
            {
                string m = ijt.GetJavascriptMethodRef(this.GetJavaScriptReferenceCode(code), methodName, code, parameters);
                if (!string.IsNullOrEmpty(m))
                {
                    if (string.IsNullOrEmpty(returnReceiver))
                    {
                        code.Add(string.Format(CultureInfo.InvariantCulture, "{0};\r\n", m));
                    }
                    else
                    {
                        code.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1};\r\n", returnReceiver, m));
                    }
                    return;
                }
            }
            WebPageCompilerUtility.CreateActionJavaScript(this.GetJavaScriptReferenceCode(code), methodName, code, parameters, returnReceiver);
        }
 public override void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver)
 {
     if (typeof(HtmlElement_BodyBase).IsAssignableFrom(this.ParameterLibType))
     {
         HtmlElement_BodyBase.CompilerCreateActionJavaScript(this.GetJavaScriptReferenceCode(code), methodName, code, parameters, returnReceiver);
     }
     else
     {
         WebPageCompilerUtility.CreateActionJavaScript(this.GetJavaScriptReferenceCode(code), methodName, code, parameters, returnReceiver);
     }
 }
示例#4
0
 public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver)
 {
     if (_pointer != null)
     {
         _pointer.CreateActionJavaScript(methodName, code, parameters, returnReceiver);
     }
     else if (_memberPointer != null)
     {
         _memberPointer.CreateActionJavaScript(methodName, code, parameters, returnReceiver);
     }
     else
     {
         WebPageCompilerUtility.CreateActionJavaScript(this.GetJavaScriptReferenceCode(code), methodName, code, parameters, returnReceiver);
     }
 }
示例#5
0
        public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver)
        {
            if (ClassType != null && _type.BaseClassType.GetInterface("IJavascriptType") != null)
            {
                IJavascriptType js = Activator.CreateInstance(_type.BaseClassType) as IJavascriptType;
                string          v  = js.GetJavascriptMethodRef(this.CodeName, methodName, code, parameters);

                if (string.IsNullOrEmpty(returnReceiver))
                {
                }
                else
                {
                    code.Add(returnReceiver);
                    code.Add("=");
                }
                code.Add(v);
                code.Add(";\r\n");
            }
            else if (this.BaseClassType.IsArray)
            {
                if (string.CompareOrdinal(methodName, "Set") == 0)
                {
                    code.Add(CodeName);
                    code.Add("[");
                    code.Add(parameters[0]);
                    code.Add("]=");
                    code.Add(parameters[1]);
                    code.Add(";\r\n");
                }
                else if (string.CompareOrdinal(methodName, "Get") == 0)
                {
                    if (!string.IsNullOrEmpty(returnReceiver))
                    {
                        code.Add(string.Format(CultureInfo.InvariantCulture,
                                               "{0}={1}[{2}];\r\n", returnReceiver, this.GetJavaScriptReferenceCode(code), parameters[0]));
                    }
                }
            }
            else
            {
                WebPageCompilerUtility.CreateActionJavaScript(this.CodeName, methodName, code, parameters, returnReceiver);
            }
        }
 public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver)
 {
     WebPageCompilerUtility.CreateActionJavaScript(this.GetJavaScriptReferenceCode(code), methodName, code, parameters, returnReceiver);
 }