Example #1
0
 private void RenderScriptBlock(StringBuilder sb, PlaceHolder ph)
 {
     if (sb.Length > 0)
     {
         string script = sb.ToString();
         if (Handlers.Resource.AllowMinify)
         {
             script = EcmaScript.Compress(script);
         }
         script = "<script type=\"text/ecmascript\">" + script + Environment.NewLine + "</script>";
         ph.Controls.Add(new LiteralControl(script));
     }
 }
        /// <remarks>
        /// By convention, some script objects are designed to support a particular
        ///	type and so are always constructed with that type's name.
        ///	Specifically, asynchronous method calls need a type against which
        ///	to invoke the method by reflection (see IDCL.Controls.Asynchronous).
        /// <see cref="IDCL.Controls.Asynchronous"/>
        /// </remarks>
        public static string CreateObject(string name, string typeName, Type t, object[] arguments)
        {
            int length = arguments.Length;

            object[] transfer = new object[length + 1];
            // type name needs to be first argument
            transfer[0] = t.QualifiedName();
            for (int x = 1; x <= length; x++)
            {
                transfer[x] = arguments[x - 1];
            }
            return(EcmaScript.CreateObject(name, typeName, transfer, null));
        }
 public static string CreateObject(string name, string typeName)
 {
     return(EcmaScript.CreateObject(name, typeName, new string[] { }, null));
 }
 public static string CreateObject(string name, string typeName, string[] arguments)
 {
     return(EcmaScript.CreateObject(name, typeName, arguments, null));
 }
 public static string CreateObject(string name, string typeName, Dictionary <string, object> properties)
 {
     return(EcmaScript.CreateObject(name, typeName, new string[] { }, properties));
 }
 public static string CreateObject(Type t, object[] arguments)
 {
     return(EcmaScript.CreateObject(t.Name, t, arguments));
 }
 public static string CreateObject(Type t)
 {
     return(EcmaScript.CreateObject(t.Name, t));
 }
 public static string CreateObject(string name, Type t)
 {
     return(EcmaScript.CreateObject(name, name + "Object", t));
 }
 // by convention, JS object function names end with "Object"
 public static string CreateObject(string name, Type t, object[] arguments)
 {
     return(EcmaScript.CreateObject(name, name + "Object", t, arguments));
 }
 public static string CreateObject(string name, string typeName, Type t)
 {
     return(EcmaScript.CreateObject(name, typeName, new string[] {
         t.QualifiedName()
     }, null));
 }