Esempio n. 1
0
		protected override void Render (HtmlTextWriter writer)
		{
			ScriptTextWriter scriptwriter = new ScriptTextWriter (writer);

			scriptwriter.WriteStartElement ("script");
			scriptwriter.WriteAttributeString ("type", "text/xml-script");
			scriptwriter.WriteStartElement ("page");
			scriptwriter.WriteAttributeString ("xmlns:script", "http://schemas.microsoft.com/xml-script/2005");

			scriptwriter.WriteStartElement ("components");
			foreach (IScriptComponent component in mgr.Components) {
				if (((IScriptObject)component).Owner == null) // only render the toplevel script objects
					component.RenderScript (scriptwriter);
			}
			scriptwriter.WriteEndElement (); // components 

			scriptwriter.WriteStartElement ("references");
			foreach (string scriptPath in mgr.ScriptRefs.Keys) {
				if ((bool)mgr.ScriptRefs[scriptPath]) {
					scriptwriter.WriteStartElement ("add");
					scriptwriter.WriteAttributeString ("src", scriptPath);
					scriptwriter.WriteEndElement ();
				}
			}
			scriptwriter.WriteEndElement (); //references

			scriptwriter.WriteEndElement (); // page
			scriptwriter.WriteEndElement (); // script

			ScriptManager.Pages.Remove (Page);
		}
Esempio n. 2
0
		protected override void AddAttributesToElement (ScriptTextWriter writer)
		{
			base.AddAttributesToElement (writer);

			// MS raises a NRE when this is called from
			// our tests.  speculation: they're accessing
			// Browser or Page to figure out if they
			// should be rendering attributes.
		}
Esempio n. 3
0
        protected override void RenderScriptTagContents(ScriptTextWriter writer)
        {
            base.RenderScriptTagContents(writer);

            if (AutoCompletionServiceMethod != "" &&
                AutoCompletionServiceUrl != "")
            {
                writer.WriteStartElement("behaviors");
                writer.WriteStartElement("autoComplete");
                writer.WriteAttributeString("serviceURL", AutoCompletionServiceUrl);
                writer.WriteAttributeString("serviceMethod", AutoCompletionServiceMethod);
                if (AutoCompletionMinimumPrefixLength != 0)
                {
                    writer.WriteAttributeString("minimumPrefixLength", AutoCompletionMinimumPrefixLength.ToString());
                }

                writer.WriteAttributeString("completionList", ID + "__autocomplete"); // XXX ?

                writer.WriteEndElement();                                             // autoComplete
                writer.WriteEndElement();                                             // behaviors
            }
        }
Esempio n. 4
0
        public void Render()
        {
            SetPropertyAction a = new SetPropertyAction();
            StringWriter      sw;
            ScriptTextWriter  w;

            // test an empty action
            sw = new StringWriter();
            w  = new ScriptTextWriter(sw);
            a.RenderAction(w);

            Assert.AreEqual("<setProperty />", sw.ToString(), "A1");

            // test with a property
            a.Target      = "target";
            a.Property    = "property";
            a.PropertyKey = "propertyKey";
            a.Value       = "value";

            sw = new StringWriter();
            w  = new ScriptTextWriter(sw);
            a.RenderAction(w);

            Assert.AreEqual("<setProperty target=\"target\" property=\"property\" propertyKey=\"propertyKey\" value=\"value\" />", sw.ToString(), "A2");

            // test with a target and id
            a.ID          = "set_id";
            a.Target      = "target";
            a.Property    = "property";
            a.PropertyKey = "propertyKey";
            a.Value       = "value";

            sw = new StringWriter();
            w  = new ScriptTextWriter(sw);
            a.RenderAction(w);

            Assert.AreEqual("<setProperty id=\"set_id\" target=\"target\" property=\"property\" propertyKey=\"propertyKey\" value=\"value\" />", sw.ToString(), "A3");
        }
Esempio n. 5
0
        protected override void Render(HtmlTextWriter writer)
        {
            ScriptTextWriter scriptwriter = new ScriptTextWriter(writer);

            scriptwriter.WriteStartElement("script");
            scriptwriter.WriteAttributeString("type", "text/xml-script");
            scriptwriter.WriteStartElement("page");
            scriptwriter.WriteAttributeString("xmlns:script", "http://schemas.microsoft.com/xml-script/2005");

            scriptwriter.WriteStartElement("components");
            foreach (IScriptComponent component in mgr.Components)
            {
                if (((IScriptObject)component).Owner == null)                 // only render the toplevel script objects
                {
                    component.RenderScript(scriptwriter);
                }
            }
            scriptwriter.WriteEndElement();              // components

            scriptwriter.WriteStartElement("references");
            foreach (string scriptPath in mgr.ScriptRefs.Keys)
            {
                if ((bool)mgr.ScriptRefs[scriptPath])
                {
                    scriptwriter.WriteStartElement("add");
                    scriptwriter.WriteAttributeString("src", scriptPath);
                    scriptwriter.WriteEndElement();
                }
            }
            scriptwriter.WriteEndElement();              //references

            scriptwriter.WriteEndElement();              // page
            scriptwriter.WriteEndElement();              // script

            ScriptManager.Pages.Remove(Page);
        }
Esempio n. 6
0
 public void AddAttributes(ScriptTextWriter w)
 {
     AddAttributesToElement(w);
 }
Esempio n. 7
0
 protected override void AddAttributesToElement(ScriptTextWriter writer)
 {
     base.AddAttributesToElement(writer);
 }
Esempio n. 8
0
 protected override void AddAttributesToElement(ScriptTextWriter writer)
 {
     Console.WriteLine("'" + Writer.ToString() + "'");
     Console.WriteLine(Environment.StackTrace);
     base.AddAttributesToElement(writer);
 }
Esempio n. 9
0
 protected override void RenderScriptTagContents(ScriptTextWriter writer)
 {
     Console.WriteLine("'" + Writer.ToString() + "'");
     Console.WriteLine(Environment.StackTrace);
     base.RenderScriptTagContents(writer);
 }