public void LayoutDeserialize(string data) { var serializer = new XmlLayoutSerializer(m_DockingManager); using (var stream = new StringReader(data)) serializer.Deserialize(stream); foreach (var layout in m_DockingManager.Layout.Descendents().OfType<LayoutContent>()) { var content = layout.Content as DockingContent; if (content != null) { layout.Title = content.Title; layout.IconSource = content.IconSource; content.PropertyChanged += (s, e) => { if (e.Property.Name == "Title") layout.Title = content.Title; else if (e.Property.Name == "IconSource") layout.IconSource = content.IconSource; }; layout.Closing += (s, e) => { content.OnClosing(e); }; layout.Closed += (s, e) => { content.OnClosed(e); }; m_Contents.Add(content.ContentKey, layout); } } }
public string LayoutSerialize() { var serializer = new XmlLayoutSerializer(m_DockingManager); using (StringWriter sw = new StringWriter()) { serializer.Serialize(sw); return sw.GetStringBuilder().ToString(); } }