Beispiel #1
0
        public virtual void WriteXml(System.Xml.XmlWriter writer)
        {
            if (!string.IsNullOrWhiteSpace(Title))
            {
                writer.WriteAttributeString("Title", Title);
            }

            //if (IconSource != null)
            //    writer.WriteAttributeString("IconSource", IconSource.ToString());

            if (IsSelected)
            {
                writer.WriteAttributeString("IsSelected", IsSelected.ToString());
            }

            if (IsLastFocusedDocument)
            {
                writer.WriteAttributeString("IsLastFocusedDocument", IsLastFocusedDocument.ToString());
            }

            if (!string.IsNullOrWhiteSpace(ContentId))
            {
                writer.WriteAttributeString("ContentId", ContentId);
            }


            if (ToolTip != null && ToolTip is string)
            {
                if (!string.IsNullOrWhiteSpace((string)ToolTip))
                {
                    writer.WriteAttributeString("ToolTip", (string)ToolTip);
                }
            }

            if (FloatingLeft != 0.0)
            {
                writer.WriteAttributeString("FloatingLeft", FloatingLeft.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingTop != 0.0)
            {
                writer.WriteAttributeString("FloatingTop", FloatingTop.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingWidth != 0.0)
            {
                writer.WriteAttributeString("FloatingWidth", FloatingWidth.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingHeight != 0.0)
            {
                writer.WriteAttributeString("FloatingHeight", FloatingHeight.ToString(CultureInfo.InvariantCulture));
            }

            if (IsMaximized)
            {
                writer.WriteAttributeString("IsMaximized", IsMaximized.ToString());
            }
            if (!CanClose)
            {
                writer.WriteAttributeString("CanClose", CanClose.ToString());
            }
            if (!CanFloat)
            {
                writer.WriteAttributeString("CanFloat", CanFloat.ToString());
            }

            if (LastActivationTimeStamp != null)
            {
                writer.WriteAttributeString("LastActivationTimeStamp", LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture));
            }

            if (_previousContainer != null)
            {
                var paneSerializable = _previousContainer as ILayoutPaneSerializable;
                if (paneSerializable != null)
                {
                    writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id);
                    writer.WriteAttributeString("PreviousContainerIndex", _previousContainerIndex.ToString());
                }
            }
        }
Beispiel #2
0
        public virtual void WriteXml(System.Xml.XmlWriter writer)
        {
            //write strong type if necessary (if it's not a basic object )
            var type = this.GetType();

            if (type.Name != "LayoutAnchorablePaneGroup" &&
                type.Name != "LayoutAnchorablePane" &&
                type.Name != "LayoutAnchorable" &&
                type.Name != "LayoutDocumentPaneGroup" &&
                type.Name != "LayoutDocumentPane" &&
                type.Name != "LayoutDocument" &&
                type.Name != "LayoutAnchorGroup" &&
                type.Name != "LayoutPanel"
                )
            {
                writer.WriteAttributeString("StrongType", type.AssemblyQualifiedName);
            }

            if (!string.IsNullOrWhiteSpace(Title))
            {
                writer.WriteAttributeString("Title", Title);
            }

            //if (IconSource != null)
            //    writer.WriteAttributeString("IconSource", IconSource.ToString());

            if (IsSelected)
            {
                writer.WriteAttributeString("IsSelected", IsSelected.ToString());
            }

            if (IsLastFocusedDocument)
            {
                writer.WriteAttributeString("IsLastFocusedDocument", IsLastFocusedDocument.ToString());
            }

            if (!string.IsNullOrWhiteSpace(ContentId))
            {
                writer.WriteAttributeString("ContentId", ContentId);
            }


            if (ToolTip != null && ToolTip is string)
            {
                if (!string.IsNullOrWhiteSpace((string)ToolTip))
                {
                    writer.WriteAttributeString("ToolTip", (string)ToolTip);
                }
            }

            if (FloatingLeft != 0.0)
            {
                writer.WriteAttributeString("FloatingLeft", FloatingLeft.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingTop != 0.0)
            {
                writer.WriteAttributeString("FloatingTop", FloatingTop.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingWidth != 0.0)
            {
                writer.WriteAttributeString("FloatingWidth", FloatingWidth.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingHeight != 0.0)
            {
                writer.WriteAttributeString("FloatingHeight", FloatingHeight.ToString(CultureInfo.InvariantCulture));
            }

            if (IsMaximized)
            {
                writer.WriteAttributeString("IsMaximized", IsMaximized.ToString());
            }
            if (!CanClose)
            {
                writer.WriteAttributeString("CanClose", CanClose.ToString());
            }
            if (!CanFloat)
            {
                writer.WriteAttributeString("CanFloat", CanFloat.ToString());
            }

            if (LastActivationTimeStamp != null)
            {
                writer.WriteAttributeString("LastActivationTimeStamp", LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture));
            }

            if (_previousContainer != null)
            {
                var paneSerializable = _previousContainer as ILayoutPaneSerializable;
                if (paneSerializable != null)
                {
                    writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id);
                    writer.WriteAttributeString("PreviousContainerIndex", _previousContainerIndex.ToString());
                }
            }
        }