Beispiel #1
0
        public ScriptEngine GetScriptEngineByMimeType(string mimeType)
        {
            ScriptEngine engine = null;

            if (mimeType == "")
            {
                mimeType = ((ISvgWindow)window).Document.RootElement.GetAttribute("contentScriptType");
            }

            if (mimeType == "" || mimeType == "text/ecmascript" || mimeType == "text/javascript" || mimeType == "application/javascript")
            {
                mimeType = "application/ecmascript";
            }

            if (!scriptEngines.Contains(mimeType))
            {
                object[] args = new object[] { (window as ISvgWindow) };
                engine = (ScriptEngine)scriptEngineByMimeType.CreateInstance(mimeType, args);
                scriptEngines.Add(mimeType, engine);
                engine.Initialise();
            }

            if (engine == null)
            {
                engine = (ScriptEngine)scriptEngines[mimeType];
            }

            return(engine);
        }
Beispiel #2
0
        /// <summary>
        /// Generates a new <see cref="RenderingNode">RenderingNode</see> that
        /// corresponds to the given <see cref="XmlElement">XmlElement</see>.
        /// </summary>
        /// <param name="node">
        /// The <see cref="XmlElement">XmlElement</see> node for which to generate
        /// a new <see cref="RenderingNode">RenderingNode</see> object.
        /// </param>
        /// <returns>
        /// The generated <see cref="RenderingNode">RenderingNode</see> that
        /// corresponds to the given <see cref="XmlElement">XmlElement</see>.
        /// </returns>
        public RenderingNode GetRenderingNode(
            ISvgElement node)
        {
            SvgElement    svgNode = (SvgElement)node;
            string        name    = svgNode.NamespaceURI + ":" + svgNode.LocalName;
            RenderingNode result;

            if (nodeByTagName.ContainsKey(name))
            {
                object[] args = new object[] { svgNode };
                result = (RenderingNode)nodeByTagName.CreateInstance(name, args);
            }
            else if (node is ISharpGDIPath)
            {
                result = new GDIPathGraphicsNode(svgNode);
            }
            else
            {
                result = new GraphicsNode(svgNode);
            }

            return(result);
        }
Beispiel #3
0
        public override XmlElement CreateElement(string prefix, string localName, string ns)
        {
            string     name = ns + ":" + localName;
            XmlElement result;

            if (nodeByTagName.ContainsKey(name))
            {
                Type     type = nodeByTagName[name];
                object[] args = new object[] { prefix, localName, ns, this };

                result = (XmlElement)nodeByTagName.CreateInstance(
                    name, args, BindingFlags.Instance | BindingFlags.NonPublic);
            }
            else if (ns == SvgNamespace)
            {
                result = new SvgElement(prefix, localName, ns, this);
            }
            else
            {
                result = base.CreateElement(prefix, localName, ns);
            }

            return(result);
        }