コード例 #1
0
        public override XElement ToXml(LazyLoadingMaterialDictionary materialDictionary)
        {
            if (Material != null)
            {
                materialDictionary.LoadMaterial(Material.Path);
            }
            XElement?texPathXEle = Material != null ? new XElement("TexturePath", materialDictionary.GetTexturePathByName(Material.Name)) : null;

            XElement result = new XElement(this.GetType().Name,
                                           Position.ToXml("Position"),
                                           Size.ToXml("Size"),
                                           texPathXEle,
                                           new XElement("Rotation", Rotation.ToString(CultureInfo.InvariantCulture)),
                                           new XElement("Opacity", Opacity.ToString(CultureInfo.InvariantCulture)),
                                           new XElement("Z-Index", ZIndex.ToString(CultureInfo.InvariantCulture))
                                           );

            if (!string.IsNullOrEmpty(Id))
            {
                result.Add(new XAttribute("Id", Id));
            }

            if (!string.IsNullOrEmpty(Class))
            {
                result.Add(new XAttribute("Class", Class));
            }

            return(result);
        }
コード例 #2
0
ファイル: Node.cs プロジェクト: xiaoxiongnpu/NodeGraph
        public override void WriteXml(XmlWriter writer)
        {
            base.WriteXml(writer);

            //{ Begin Creation info : You need not deserialize this block in ReadXml().
            // These are automatically serialized in FlowChart.ReadXml().
            writer.WriteAttributeString("ViewModelType", ViewModel.GetType().FullName);
            writer.WriteAttributeString("Owner", Owner.Guid.ToString());
            //} End creation info.

            writer.WriteAttributeString("Header", Header);
            writer.WriteAttributeString("HeaderBackgroundColor", HeaderBackgroundColor.ToString());
            writer.WriteAttributeString("HeaderFontColor", HeaderFontColor.ToString());
            writer.WriteAttributeString("AllowEditingHeader", AllowEditingHeader.ToString());

            writer.WriteAttributeString("AllowCircularConnection", AllowCircularConnection.ToString());

            writer.WriteAttributeString("X", X.ToString());
            writer.WriteAttributeString("Y", Y.ToString());
            writer.WriteAttributeString("ZIndex", ZIndex.ToString());

            writer.WriteStartElement("InputFlowPorts");
            foreach (var port in InputFlowPorts)
            {
                writer.WriteStartElement("FlowPort");
                port.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteStartElement("OutputFlowPorts");
            foreach (var port in OutputFlowPorts)
            {
                writer.WriteStartElement("FlowPort");
                port.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteStartElement("InputPropertyPorts");
            foreach (var port in InputPropertyPorts)
            {
                writer.WriteStartElement("PropertyPort");
                port.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteStartElement("OutputPropertyPorts");
            foreach (var port in OutputPropertyPorts)
            {
                writer.WriteStartElement("PropertyPort");
                port.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }
コード例 #3
0
        //void PageInit(object sender, EventArgs e)
        //{
        //    Page.Form.Controls.Add(this);
        //}

        private void RenderModalBackground()
        {
            if (this.Visible)
            {
                this.Attributes.CssStyle.Add("z-index", (ZIndex + 1).ToString());

                // modal background creation
                HtmlGenericControl div = new HtmlGenericControl(HtmlTextWriterTag.Div.ToString());
                div.Attributes.Add("class", "modalbackground");
                div.Style.Add("z-index", ZIndex.ToString()); // HtmlTextWriterStyle.ZIndex rendered without hypen
                div.Style.Add("opacity", string.Format(".{0}", ModalBackgroundOpacity / 10));
                div.Style.Add(HtmlTextWriterStyle.Filter.ToString(), string.Format("alpha(opacity={0})", ModalBackgroundOpacity));
                div.ID = string.Format("{0}_modal", this.ID);

                Page.Form.Style.Add(HtmlTextWriterStyle.Height.ToString(), "100%");
                Page.Form.Controls.Add(div);
            }
        }
コード例 #4
0
            public override void WriteTo(XmlWriter xmlWriter)
            {
                xmlWriter.WriteStartElement("Image");
                {
                    xmlWriter.WriteAttributeString("Name", Name);

                    if (!IsTableOrMatrixSubItem)
                    {
                        xmlWriter.WriteElementString("Top", Item.Top.ToString());
                        xmlWriter.WriteElementString("Width", Item.Width.ToString());
                    }

                    if (!IsTableOrMatrixSubItem)
                    {
                        xmlWriter.WriteElementString("Left", Item.Left.ToString());
                        xmlWriter.WriteElementString("Height", Item.Height.ToString());
                    }

                    if (ImageBox.Action != null)
                    {
                        RAction rAction = new RAction(ImageBox.Action);
                        rAction.WriteTo(xmlWriter);
                    }

                    //Style
                    //base.Write(xmlWriter);
                    RStyle rStyle = new RStyle(this, Item.Style);
                    rStyle.WriteTo(xmlWriter);

                    xmlWriter.WriteElementString("ZIndex", ZIndex.ToString());

                    RBaseImage rBaseImage = new RBaseImage(ImageBox.Image);
                    rBaseImage.WriteTo(xmlWriter);
                }
                xmlWriter.WriteEndElement();
            }
コード例 #5
0
        private void RenderScriptBlock(HtmlTextWriter output)
        {
            output.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
            output.RenderBeginTag(HtmlTextWriterTag.Script);

            output.Write("var ");
            output.Write(ClientID);
            output.Write("_obj = new ModalPopup('");
            output.Write(ClientID);
            output.Write("', '");
            output.Write(OpenElementClientID);
            output.Write("', ");
            if (!string.IsNullOrEmpty(CloseElementClientID))
            {
                output.Write("'");
                output.Write(CloseElementClientID);
                output.Write("', ");
            }
            else
            {
                output.Write("false, ");
            }

            //Options
            output.Write("{");
            if (Width != Unit.Empty)
            {
                output.Write(String.Format("width: {0},", Width.ToString()));
            }
            if (Height != Unit.Empty)
            {
                output.Write(String.Format("height: {0},", Height.ToString()));
            }

            output.Write(String.Format("overlayOpacity: {0}, ", OverlayOpacity.ToString()));
            output.Write(String.Format("zIndex: {0}", ZIndex.ToString()));

            if (OverlayColor != Color.Empty)
            {
                output.Write(String.Format(", overlayBackgroundColor: '{0}'", ColorTranslator.ToHtml(OverlayColor)));
            }

            if (!string.IsNullOrEmpty(OnClientBeforeOpen))
            {
                output.Write(RenderCallback("beforeOpen", OnClientBeforeOpen));
            }

            if (!string.IsNullOrEmpty(OnClientAfterOpen))
            {
                output.Write(RenderCallback("afterOpen", OnClientAfterOpen));
            }

            if (!string.IsNullOrEmpty(OnClientBeforeClose))
            {
                output.Write(RenderCallback("beforeClose", OnClientBeforeClose));
            }

            if (!string.IsNullOrEmpty(OnClientAfterClose))
            {
                output.Write(RenderCallback("afterClose", OnClientAfterClose));
            }

            output.Write("});");

            output.RenderEndTag();
        }