[2134] | 1 | using System;
|
---|
| 2 | using System.ComponentModel;
|
---|
| 3 | using System.Windows.Forms;
|
---|
| 4 | using System.Drawing;
|
---|
| 5 | using WeifenLuo.WinFormsUI.Docking;
|
---|
| 6 | using System.IO;
|
---|
| 7 | using System.Text;
|
---|
| 8 | using System.Xml;
|
---|
| 9 | using System.Globalization;
|
---|
| 10 |
|
---|
| 11 | namespace WeifenLuo.WinFormsUI.Docking
|
---|
| 12 | {
|
---|
| 13 | partial class DockPanel
|
---|
| 14 | {
|
---|
| 15 | private static class Persistor
|
---|
| 16 | {
|
---|
| 17 | private const string ConfigFileVersion = "1.0";
|
---|
| 18 | private static string[] CompatibleConfigFileVersions = new string[] { };
|
---|
| 19 |
|
---|
| 20 | private class DummyContent : DockContent
|
---|
| 21 | {
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | private struct DockPanelStruct
|
---|
| 25 | {
|
---|
| 26 | private double m_dockLeftPortion;
|
---|
| 27 | public double DockLeftPortion
|
---|
| 28 | {
|
---|
| 29 | get { return m_dockLeftPortion; }
|
---|
| 30 | set { m_dockLeftPortion = value; }
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | private double m_dockRightPortion;
|
---|
| 34 | public double DockRightPortion
|
---|
| 35 | {
|
---|
| 36 | get { return m_dockRightPortion; }
|
---|
| 37 | set { m_dockRightPortion = value; }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | private double m_dockTopPortion;
|
---|
| 41 | public double DockTopPortion
|
---|
| 42 | {
|
---|
| 43 | get { return m_dockTopPortion; }
|
---|
| 44 | set { m_dockTopPortion = value; }
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | private double m_dockBottomPortion;
|
---|
| 48 | public double DockBottomPortion
|
---|
| 49 | {
|
---|
| 50 | get { return m_dockBottomPortion; }
|
---|
| 51 | set { m_dockBottomPortion = value; }
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | private int m_indexActiveDocumentPane;
|
---|
| 55 | public int IndexActiveDocumentPane
|
---|
| 56 | {
|
---|
| 57 | get { return m_indexActiveDocumentPane; }
|
---|
| 58 | set { m_indexActiveDocumentPane = value; }
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | private int m_indexActivePane;
|
---|
| 62 | public int IndexActivePane
|
---|
| 63 | {
|
---|
| 64 | get { return m_indexActivePane; }
|
---|
| 65 | set { m_indexActivePane = value; }
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | private struct ContentStruct
|
---|
| 70 | {
|
---|
| 71 | private string m_persistString;
|
---|
| 72 | public string PersistString
|
---|
| 73 | {
|
---|
| 74 | get { return m_persistString; }
|
---|
| 75 | set { m_persistString = value; }
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | private double m_autoHidePortion;
|
---|
| 79 | public double AutoHidePortion
|
---|
| 80 | {
|
---|
| 81 | get { return m_autoHidePortion; }
|
---|
| 82 | set { m_autoHidePortion = value; }
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | private bool m_isHidden;
|
---|
| 86 | public bool IsHidden
|
---|
| 87 | {
|
---|
| 88 | get { return m_isHidden; }
|
---|
| 89 | set { m_isHidden = value; }
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | private bool m_isFloat;
|
---|
| 93 | public bool IsFloat
|
---|
| 94 | {
|
---|
| 95 | get { return m_isFloat; }
|
---|
| 96 | set { m_isFloat = value; }
|
---|
| 97 | }
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 | private struct PaneStruct
|
---|
| 101 | {
|
---|
| 102 | private DockState m_dockState;
|
---|
| 103 | public DockState DockState
|
---|
| 104 | {
|
---|
| 105 | get { return m_dockState; }
|
---|
| 106 | set { m_dockState = value; }
|
---|
| 107 | }
|
---|
| 108 |
|
---|
| 109 | private int m_indexActiveContent;
|
---|
| 110 | public int IndexActiveContent
|
---|
| 111 | {
|
---|
| 112 | get { return m_indexActiveContent; }
|
---|
| 113 | set { m_indexActiveContent = value; }
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | private int[] m_indexContents;
|
---|
| 117 | public int[] IndexContents
|
---|
| 118 | {
|
---|
| 119 | get { return m_indexContents; }
|
---|
| 120 | set { m_indexContents = value; }
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 | private int m_zOrderIndex;
|
---|
| 124 | public int ZOrderIndex
|
---|
| 125 | {
|
---|
| 126 | get { return m_zOrderIndex; }
|
---|
| 127 | set { m_zOrderIndex = value; }
|
---|
| 128 | }
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | private struct NestedPane
|
---|
| 132 | {
|
---|
| 133 | private int m_indexPane;
|
---|
| 134 | public int IndexPane
|
---|
| 135 | {
|
---|
| 136 | get { return m_indexPane; }
|
---|
| 137 | set { m_indexPane = value; }
|
---|
| 138 | }
|
---|
| 139 |
|
---|
| 140 | private int m_indexPrevPane;
|
---|
| 141 | public int IndexPrevPane
|
---|
| 142 | {
|
---|
| 143 | get { return m_indexPrevPane; }
|
---|
| 144 | set { m_indexPrevPane = value; }
|
---|
| 145 | }
|
---|
| 146 |
|
---|
| 147 | private DockAlignment m_alignment;
|
---|
| 148 | public DockAlignment Alignment
|
---|
| 149 | {
|
---|
| 150 | get { return m_alignment; }
|
---|
| 151 | set { m_alignment = value; }
|
---|
| 152 | }
|
---|
| 153 |
|
---|
| 154 | private double m_proportion;
|
---|
| 155 | public double Proportion
|
---|
| 156 | {
|
---|
| 157 | get { return m_proportion; }
|
---|
| 158 | set { m_proportion = value; }
|
---|
| 159 | }
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 | private struct DockWindowStruct
|
---|
| 163 | {
|
---|
| 164 | private DockState m_dockState;
|
---|
| 165 | public DockState DockState
|
---|
| 166 | {
|
---|
| 167 | get { return m_dockState; }
|
---|
| 168 | set { m_dockState = value; }
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 | private int m_zOrderIndex;
|
---|
| 172 | public int ZOrderIndex
|
---|
| 173 | {
|
---|
| 174 | get { return m_zOrderIndex; }
|
---|
| 175 | set { m_zOrderIndex = value; }
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | private NestedPane[] m_nestedPanes;
|
---|
| 179 | public NestedPane[] NestedPanes
|
---|
| 180 | {
|
---|
| 181 | get { return m_nestedPanes; }
|
---|
| 182 | set { m_nestedPanes = value; }
|
---|
| 183 | }
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | private struct FloatWindowStruct
|
---|
| 187 | {
|
---|
| 188 | private Rectangle m_bounds;
|
---|
| 189 | public Rectangle Bounds
|
---|
| 190 | {
|
---|
| 191 | get { return m_bounds; }
|
---|
| 192 | set { m_bounds = value; }
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | private int m_zOrderIndex;
|
---|
| 196 | public int ZOrderIndex
|
---|
| 197 | {
|
---|
| 198 | get { return m_zOrderIndex; }
|
---|
| 199 | set { m_zOrderIndex = value; }
|
---|
| 200 | }
|
---|
| 201 |
|
---|
| 202 | private NestedPane[] m_nestedPanes;
|
---|
| 203 | public NestedPane[] NestedPanes
|
---|
| 204 | {
|
---|
| 205 | get { return m_nestedPanes; }
|
---|
| 206 | set { m_nestedPanes = value; }
|
---|
| 207 | }
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | public static void SaveAsXml(DockPanel dockPanel, string fileName)
|
---|
| 211 | {
|
---|
| 212 | SaveAsXml(dockPanel, fileName, Encoding.Unicode);
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | public static void SaveAsXml(DockPanel dockPanel, string fileName, Encoding encoding)
|
---|
| 216 | {
|
---|
| 217 | FileStream fs = new FileStream(fileName, FileMode.Create);
|
---|
| 218 | try
|
---|
| 219 | {
|
---|
| 220 | SaveAsXml(dockPanel, fs, encoding);
|
---|
| 221 | }
|
---|
| 222 | finally
|
---|
| 223 | {
|
---|
| 224 | fs.Close();
|
---|
| 225 | }
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 | public static void SaveAsXml(DockPanel dockPanel, Stream stream, Encoding encoding)
|
---|
| 229 | {
|
---|
| 230 | SaveAsXml(dockPanel, stream, encoding, false);
|
---|
| 231 | }
|
---|
| 232 |
|
---|
| 233 | public static void SaveAsXml(DockPanel dockPanel, Stream stream, Encoding encoding, bool upstream)
|
---|
| 234 | {
|
---|
| 235 | XmlTextWriter xmlOut = new XmlTextWriter(stream, encoding);
|
---|
| 236 |
|
---|
| 237 | // Use indenting for readability
|
---|
| 238 | xmlOut.Formatting = Formatting.Indented;
|
---|
| 239 |
|
---|
| 240 | if (!upstream)
|
---|
| 241 | xmlOut.WriteStartDocument();
|
---|
| 242 |
|
---|
| 243 | // Always begin file with identification and warning
|
---|
| 244 | xmlOut.WriteComment(Strings.DockPanel_Persistor_XmlFileComment1);
|
---|
| 245 | xmlOut.WriteComment(Strings.DockPanel_Persistor_XmlFileComment2);
|
---|
| 246 |
|
---|
| 247 | // Associate a version number with the root element so that future version of the code
|
---|
| 248 | // will be able to be backwards compatible or at least recognise out of date versions
|
---|
| 249 | xmlOut.WriteStartElement("DockPanel");
|
---|
| 250 | xmlOut.WriteAttributeString("FormatVersion", ConfigFileVersion);
|
---|
| 251 | xmlOut.WriteAttributeString("DockLeftPortion", dockPanel.DockLeftPortion.ToString(CultureInfo.InvariantCulture));
|
---|
| 252 | xmlOut.WriteAttributeString("DockRightPortion", dockPanel.DockRightPortion.ToString(CultureInfo.InvariantCulture));
|
---|
| 253 | xmlOut.WriteAttributeString("DockTopPortion", dockPanel.DockTopPortion.ToString(CultureInfo.InvariantCulture));
|
---|
| 254 | xmlOut.WriteAttributeString("DockBottomPortion", dockPanel.DockBottomPortion.ToString(CultureInfo.InvariantCulture));
|
---|
| 255 | xmlOut.WriteAttributeString("ActiveDocumentPane", dockPanel.Panes.IndexOf(dockPanel.ActiveDocumentPane).ToString(CultureInfo.InvariantCulture));
|
---|
| 256 | xmlOut.WriteAttributeString("ActivePane", dockPanel.Panes.IndexOf(dockPanel.ActivePane).ToString(CultureInfo.InvariantCulture));
|
---|
| 257 |
|
---|
| 258 | // Contents
|
---|
| 259 | xmlOut.WriteStartElement("Contents");
|
---|
| 260 | xmlOut.WriteAttributeString("Count", dockPanel.Contents.Count.ToString(CultureInfo.InvariantCulture));
|
---|
| 261 | foreach (IDockContent content in dockPanel.Contents)
|
---|
| 262 | {
|
---|
| 263 | xmlOut.WriteStartElement("Content");
|
---|
| 264 | xmlOut.WriteAttributeString("ID", dockPanel.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture));
|
---|
| 265 | xmlOut.WriteAttributeString("PersistString", content.DockHandler.PersistString);
|
---|
| 266 | xmlOut.WriteAttributeString("AutoHidePortion", content.DockHandler.AutoHidePortion.ToString(CultureInfo.InvariantCulture));
|
---|
| 267 | xmlOut.WriteAttributeString("IsHidden", content.DockHandler.IsHidden.ToString(CultureInfo.InvariantCulture));
|
---|
| 268 | xmlOut.WriteAttributeString("IsFloat", content.DockHandler.IsFloat.ToString(CultureInfo.InvariantCulture));
|
---|
| 269 | xmlOut.WriteEndElement();
|
---|
| 270 | }
|
---|
| 271 | xmlOut.WriteEndElement();
|
---|
| 272 |
|
---|
| 273 | // Panes
|
---|
| 274 | xmlOut.WriteStartElement("Panes");
|
---|
| 275 | xmlOut.WriteAttributeString("Count", dockPanel.Panes.Count.ToString(CultureInfo.InvariantCulture));
|
---|
| 276 | foreach (DockPane pane in dockPanel.Panes)
|
---|
| 277 | {
|
---|
| 278 | xmlOut.WriteStartElement("Pane");
|
---|
| 279 | xmlOut.WriteAttributeString("ID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
|
---|
| 280 | xmlOut.WriteAttributeString("DockState", pane.DockState.ToString());
|
---|
| 281 | xmlOut.WriteAttributeString("ActiveContent", dockPanel.Contents.IndexOf(pane.ActiveContent).ToString(CultureInfo.InvariantCulture));
|
---|
| 282 | xmlOut.WriteStartElement("Contents");
|
---|
| 283 | xmlOut.WriteAttributeString("Count", pane.Contents.Count.ToString(CultureInfo.InvariantCulture));
|
---|
| 284 | foreach (IDockContent content in pane.Contents)
|
---|
| 285 | {
|
---|
| 286 | xmlOut.WriteStartElement("Content");
|
---|
| 287 | xmlOut.WriteAttributeString("ID", pane.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture));
|
---|
| 288 | xmlOut.WriteAttributeString("RefID", dockPanel.Contents.IndexOf(content).ToString(CultureInfo.InvariantCulture));
|
---|
| 289 | xmlOut.WriteEndElement();
|
---|
| 290 | }
|
---|
| 291 | xmlOut.WriteEndElement();
|
---|
| 292 | xmlOut.WriteEndElement();
|
---|
| 293 | }
|
---|
| 294 | xmlOut.WriteEndElement();
|
---|
| 295 |
|
---|
| 296 | // DockWindows
|
---|
| 297 | xmlOut.WriteStartElement("DockWindows");
|
---|
| 298 | int dockWindowId = 0;
|
---|
| 299 | foreach (DockWindow dw in dockPanel.DockWindows)
|
---|
| 300 | {
|
---|
| 301 | xmlOut.WriteStartElement("DockWindow");
|
---|
| 302 | xmlOut.WriteAttributeString("ID", dockWindowId.ToString(CultureInfo.InvariantCulture));
|
---|
| 303 | dockWindowId++;
|
---|
| 304 | xmlOut.WriteAttributeString("DockState", dw.DockState.ToString());
|
---|
| 305 | xmlOut.WriteAttributeString("ZOrderIndex", dockPanel.Controls.IndexOf(dw).ToString(CultureInfo.InvariantCulture));
|
---|
| 306 | xmlOut.WriteStartElement("NestedPanes");
|
---|
| 307 | xmlOut.WriteAttributeString("Count", dw.NestedPanes.Count.ToString(CultureInfo.InvariantCulture));
|
---|
| 308 | foreach (DockPane pane in dw.NestedPanes)
|
---|
| 309 | {
|
---|
| 310 | xmlOut.WriteStartElement("Pane");
|
---|
| 311 | xmlOut.WriteAttributeString("ID", dw.NestedPanes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
|
---|
| 312 | xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
|
---|
| 313 | NestedDockingStatus status = pane.NestedDockingStatus;
|
---|
| 314 | xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PreviousPane).ToString(CultureInfo.InvariantCulture));
|
---|
| 315 | xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString());
|
---|
| 316 | xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture));
|
---|
| 317 | xmlOut.WriteEndElement();
|
---|
| 318 | }
|
---|
| 319 | xmlOut.WriteEndElement();
|
---|
| 320 | xmlOut.WriteEndElement();
|
---|
| 321 | }
|
---|
| 322 | xmlOut.WriteEndElement();
|
---|
| 323 |
|
---|
| 324 | // FloatWindows
|
---|
| 325 | RectangleConverter rectConverter = new RectangleConverter();
|
---|
| 326 | xmlOut.WriteStartElement("FloatWindows");
|
---|
| 327 | xmlOut.WriteAttributeString("Count", dockPanel.FloatWindows.Count.ToString(CultureInfo.InvariantCulture));
|
---|
| 328 | foreach (FloatWindow fw in dockPanel.FloatWindows)
|
---|
| 329 | {
|
---|
| 330 | xmlOut.WriteStartElement("FloatWindow");
|
---|
| 331 | xmlOut.WriteAttributeString("ID", dockPanel.FloatWindows.IndexOf(fw).ToString(CultureInfo.InvariantCulture));
|
---|
| 332 | xmlOut.WriteAttributeString("Bounds", rectConverter.ConvertToInvariantString(fw.Bounds));
|
---|
| 333 | xmlOut.WriteAttributeString("ZOrderIndex", fw.DockPanel.FloatWindows.IndexOf(fw).ToString(CultureInfo.InvariantCulture));
|
---|
| 334 | xmlOut.WriteStartElement("NestedPanes");
|
---|
| 335 | xmlOut.WriteAttributeString("Count", fw.NestedPanes.Count.ToString(CultureInfo.InvariantCulture));
|
---|
| 336 | foreach (DockPane pane in fw.NestedPanes)
|
---|
| 337 | {
|
---|
| 338 | xmlOut.WriteStartElement("Pane");
|
---|
| 339 | xmlOut.WriteAttributeString("ID", fw.NestedPanes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
|
---|
| 340 | xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString(CultureInfo.InvariantCulture));
|
---|
| 341 | NestedDockingStatus status = pane.NestedDockingStatus;
|
---|
| 342 | xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PreviousPane).ToString(CultureInfo.InvariantCulture));
|
---|
| 343 | xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString());
|
---|
| 344 | xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture));
|
---|
| 345 | xmlOut.WriteEndElement();
|
---|
| 346 | }
|
---|
| 347 | xmlOut.WriteEndElement();
|
---|
| 348 | xmlOut.WriteEndElement();
|
---|
| 349 | }
|
---|
| 350 | xmlOut.WriteEndElement(); // </FloatWindows>
|
---|
| 351 |
|
---|
| 352 | xmlOut.WriteEndElement();
|
---|
| 353 |
|
---|
| 354 | if (!upstream)
|
---|
| 355 | {
|
---|
| 356 | xmlOut.WriteEndDocument();
|
---|
| 357 | xmlOut.Close();
|
---|
| 358 | }
|
---|
| 359 | else
|
---|
| 360 | xmlOut.Flush();
|
---|
| 361 | }
|
---|
| 362 |
|
---|
| 363 | public static void LoadFromXml(DockPanel dockPanel, string fileName, DeserializeDockContent deserializeContent)
|
---|
| 364 | {
|
---|
| 365 | FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
|
---|
| 366 | try
|
---|
| 367 | {
|
---|
| 368 | LoadFromXml(dockPanel, fs, deserializeContent);
|
---|
| 369 | }
|
---|
| 370 | finally
|
---|
| 371 | {
|
---|
| 372 | fs.Close();
|
---|
| 373 | }
|
---|
| 374 | }
|
---|
| 375 |
|
---|
| 376 | public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent)
|
---|
| 377 | {
|
---|
| 378 | LoadFromXml(dockPanel, stream, deserializeContent, true);
|
---|
| 379 | }
|
---|
| 380 |
|
---|
| 381 | private static ContentStruct[] LoadContents(XmlTextReader xmlIn)
|
---|
| 382 | {
|
---|
| 383 | int countOfContents = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
|
---|
| 384 | ContentStruct[] contents = new ContentStruct[countOfContents];
|
---|
| 385 | MoveToNextElement(xmlIn);
|
---|
| 386 | for (int i = 0; i < countOfContents; i++)
|
---|
| 387 | {
|
---|
| 388 | int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
|
---|
| 389 | if (xmlIn.Name != "Content" || id != i)
|
---|
| 390 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 391 |
|
---|
| 392 | contents[i].PersistString = xmlIn.GetAttribute("PersistString");
|
---|
| 393 | contents[i].AutoHidePortion = Convert.ToDouble(xmlIn.GetAttribute("AutoHidePortion"), CultureInfo.InvariantCulture);
|
---|
| 394 | contents[i].IsHidden = Convert.ToBoolean(xmlIn.GetAttribute("IsHidden"), CultureInfo.InvariantCulture);
|
---|
| 395 | contents[i].IsFloat = Convert.ToBoolean(xmlIn.GetAttribute("IsFloat"), CultureInfo.InvariantCulture);
|
---|
| 396 | MoveToNextElement(xmlIn);
|
---|
| 397 | }
|
---|
| 398 |
|
---|
| 399 | return contents;
|
---|
| 400 | }
|
---|
| 401 |
|
---|
| 402 | private static PaneStruct[] LoadPanes(XmlTextReader xmlIn)
|
---|
| 403 | {
|
---|
| 404 | EnumConverter dockStateConverter = new EnumConverter(typeof(DockState));
|
---|
| 405 | int countOfPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
|
---|
| 406 | PaneStruct[] panes = new PaneStruct[countOfPanes];
|
---|
| 407 | MoveToNextElement(xmlIn);
|
---|
| 408 | for (int i = 0; i < countOfPanes; i++)
|
---|
| 409 | {
|
---|
| 410 | int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
|
---|
| 411 | if (xmlIn.Name != "Pane" || id != i)
|
---|
| 412 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 413 |
|
---|
| 414 | panes[i].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
|
---|
| 415 | panes[i].IndexActiveContent = Convert.ToInt32(xmlIn.GetAttribute("ActiveContent"), CultureInfo.InvariantCulture);
|
---|
| 416 | panes[i].ZOrderIndex = -1;
|
---|
| 417 |
|
---|
| 418 | MoveToNextElement(xmlIn);
|
---|
| 419 | if (xmlIn.Name != "Contents")
|
---|
| 420 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 421 | int countOfPaneContents = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
|
---|
| 422 | panes[i].IndexContents = new int[countOfPaneContents];
|
---|
| 423 | MoveToNextElement(xmlIn);
|
---|
| 424 | for (int j = 0; j < countOfPaneContents; j++)
|
---|
| 425 | {
|
---|
| 426 | int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
|
---|
| 427 | if (xmlIn.Name != "Content" || id2 != j)
|
---|
| 428 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 429 |
|
---|
| 430 | panes[i].IndexContents[j] = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture);
|
---|
| 431 | MoveToNextElement(xmlIn);
|
---|
| 432 | }
|
---|
| 433 | }
|
---|
| 434 |
|
---|
| 435 | return panes;
|
---|
| 436 | }
|
---|
| 437 |
|
---|
| 438 | private static DockWindowStruct[] LoadDockWindows(XmlTextReader xmlIn, DockPanel dockPanel)
|
---|
| 439 | {
|
---|
| 440 | EnumConverter dockStateConverter = new EnumConverter(typeof(DockState));
|
---|
| 441 | EnumConverter dockAlignmentConverter = new EnumConverter(typeof(DockAlignment));
|
---|
| 442 | int countOfDockWindows = dockPanel.DockWindows.Count;
|
---|
| 443 | DockWindowStruct[] dockWindows = new DockWindowStruct[countOfDockWindows];
|
---|
| 444 | MoveToNextElement(xmlIn);
|
---|
| 445 | for (int i = 0; i < countOfDockWindows; i++)
|
---|
| 446 | {
|
---|
| 447 | int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
|
---|
| 448 | if (xmlIn.Name != "DockWindow" || id != i)
|
---|
| 449 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 450 |
|
---|
| 451 | dockWindows[i].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
|
---|
| 452 | dockWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"), CultureInfo.InvariantCulture);
|
---|
| 453 | MoveToNextElement(xmlIn);
|
---|
| 454 | if (xmlIn.Name != "DockList" && xmlIn.Name != "NestedPanes")
|
---|
| 455 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 456 | int countOfNestedPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
|
---|
| 457 | dockWindows[i].NestedPanes = new NestedPane[countOfNestedPanes];
|
---|
| 458 | MoveToNextElement(xmlIn);
|
---|
| 459 | for (int j = 0; j < countOfNestedPanes; j++)
|
---|
| 460 | {
|
---|
| 461 | int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
|
---|
| 462 | if (xmlIn.Name != "Pane" || id2 != j)
|
---|
| 463 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 464 | dockWindows[i].NestedPanes[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture);
|
---|
| 465 | dockWindows[i].NestedPanes[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"), CultureInfo.InvariantCulture);
|
---|
| 466 | dockWindows[i].NestedPanes[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
|
---|
| 467 | dockWindows[i].NestedPanes[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
|
---|
| 468 | MoveToNextElement(xmlIn);
|
---|
| 469 | }
|
---|
| 470 | }
|
---|
| 471 |
|
---|
| 472 | return dockWindows;
|
---|
| 473 | }
|
---|
| 474 |
|
---|
| 475 | private static FloatWindowStruct[] LoadFloatWindows(XmlTextReader xmlIn)
|
---|
| 476 | {
|
---|
| 477 | EnumConverter dockAlignmentConverter = new EnumConverter(typeof(DockAlignment));
|
---|
| 478 | RectangleConverter rectConverter = new RectangleConverter();
|
---|
| 479 | int countOfFloatWindows = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
|
---|
| 480 | FloatWindowStruct[] floatWindows = new FloatWindowStruct[countOfFloatWindows];
|
---|
| 481 | MoveToNextElement(xmlIn);
|
---|
| 482 | for (int i = 0; i < countOfFloatWindows; i++)
|
---|
| 483 | {
|
---|
| 484 | int id = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
|
---|
| 485 | if (xmlIn.Name != "FloatWindow" || id != i)
|
---|
| 486 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 487 |
|
---|
| 488 | floatWindows[i].Bounds = (Rectangle)rectConverter.ConvertFromInvariantString(xmlIn.GetAttribute("Bounds"));
|
---|
| 489 | floatWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"), CultureInfo.InvariantCulture);
|
---|
| 490 | MoveToNextElement(xmlIn);
|
---|
| 491 | if (xmlIn.Name != "DockList" && xmlIn.Name != "NestedPanes")
|
---|
| 492 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 493 | int countOfNestedPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"), CultureInfo.InvariantCulture);
|
---|
| 494 | floatWindows[i].NestedPanes = new NestedPane[countOfNestedPanes];
|
---|
| 495 | MoveToNextElement(xmlIn);
|
---|
| 496 | for (int j = 0; j < countOfNestedPanes; j++)
|
---|
| 497 | {
|
---|
| 498 | int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"), CultureInfo.InvariantCulture);
|
---|
| 499 | if (xmlIn.Name != "Pane" || id2 != j)
|
---|
| 500 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 501 | floatWindows[i].NestedPanes[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID"), CultureInfo.InvariantCulture);
|
---|
| 502 | floatWindows[i].NestedPanes[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"), CultureInfo.InvariantCulture);
|
---|
| 503 | floatWindows[i].NestedPanes[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
|
---|
| 504 | floatWindows[i].NestedPanes[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
|
---|
| 505 | MoveToNextElement(xmlIn);
|
---|
| 506 | }
|
---|
| 507 | }
|
---|
| 508 |
|
---|
| 509 | return floatWindows;
|
---|
| 510 | }
|
---|
| 511 |
|
---|
| 512 | public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
|
---|
| 513 | {
|
---|
| 514 |
|
---|
| 515 | if (dockPanel.Contents.Count != 0)
|
---|
| 516 | throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized);
|
---|
| 517 |
|
---|
| 518 | XmlTextReader xmlIn = new XmlTextReader(stream);
|
---|
| 519 | xmlIn.WhitespaceHandling = WhitespaceHandling.None;
|
---|
| 520 | xmlIn.MoveToContent();
|
---|
| 521 |
|
---|
| 522 | while (!xmlIn.Name.Equals("DockPanel"))
|
---|
| 523 | {
|
---|
| 524 | if (!MoveToNextElement(xmlIn))
|
---|
| 525 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 526 | }
|
---|
| 527 |
|
---|
| 528 | string formatVersion = xmlIn.GetAttribute("FormatVersion");
|
---|
| 529 | if (!IsFormatVersionValid(formatVersion))
|
---|
| 530 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidFormatVersion);
|
---|
| 531 |
|
---|
| 532 | DockPanelStruct dockPanelStruct = new DockPanelStruct();
|
---|
| 533 | dockPanelStruct.DockLeftPortion = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture);
|
---|
| 534 | dockPanelStruct.DockRightPortion = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture);
|
---|
| 535 | dockPanelStruct.DockTopPortion = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture);
|
---|
| 536 | dockPanelStruct.DockBottomPortion = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture);
|
---|
| 537 | dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"), CultureInfo.InvariantCulture);
|
---|
| 538 | dockPanelStruct.IndexActivePane = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);
|
---|
| 539 |
|
---|
| 540 | // Load Contents
|
---|
| 541 | MoveToNextElement(xmlIn);
|
---|
| 542 | if (xmlIn.Name != "Contents")
|
---|
| 543 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 544 | ContentStruct[] contents = LoadContents(xmlIn);
|
---|
| 545 |
|
---|
| 546 | // Load Panes
|
---|
| 547 | if (xmlIn.Name != "Panes")
|
---|
| 548 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 549 | PaneStruct[] panes = LoadPanes(xmlIn);
|
---|
| 550 |
|
---|
| 551 | // Load DockWindows
|
---|
| 552 | if (xmlIn.Name != "DockWindows")
|
---|
| 553 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 554 | DockWindowStruct[] dockWindows = LoadDockWindows(xmlIn, dockPanel);
|
---|
| 555 |
|
---|
| 556 | // Load FloatWindows
|
---|
| 557 | if (xmlIn.Name != "FloatWindows")
|
---|
| 558 | throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
|
---|
| 559 | FloatWindowStruct[] floatWindows = LoadFloatWindows(xmlIn);
|
---|
| 560 |
|
---|
| 561 | if (closeStream)
|
---|
| 562 | xmlIn.Close();
|
---|
| 563 |
|
---|
| 564 | dockPanel.SuspendLayout(true);
|
---|
| 565 |
|
---|
| 566 | dockPanel.DockLeftPortion = dockPanelStruct.DockLeftPortion;
|
---|
| 567 | dockPanel.DockRightPortion = dockPanelStruct.DockRightPortion;
|
---|
| 568 | dockPanel.DockTopPortion = dockPanelStruct.DockTopPortion;
|
---|
| 569 | dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;
|
---|
| 570 |
|
---|
| 571 | // Set DockWindow ZOrders
|
---|
| 572 | int prevMaxDockWindowZOrder = int.MaxValue;
|
---|
| 573 | for (int i = 0; i < dockWindows.Length; i++)
|
---|
| 574 | {
|
---|
| 575 | int maxDockWindowZOrder = -1;
|
---|
| 576 | int index = -1;
|
---|
| 577 | for (int j = 0; j < dockWindows.Length; j++)
|
---|
| 578 | {
|
---|
| 579 | if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder)
|
---|
| 580 | {
|
---|
| 581 | maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
|
---|
| 582 | index = j;
|
---|
| 583 | }
|
---|
| 584 | }
|
---|
| 585 |
|
---|
| 586 | dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
|
---|
| 587 | prevMaxDockWindowZOrder = maxDockWindowZOrder;
|
---|
| 588 | }
|
---|
| 589 |
|
---|
| 590 | // Create Contents
|
---|
| 591 | for (int i = 0; i < contents.Length; i++)
|
---|
| 592 | {
|
---|
| 593 | IDockContent content = deserializeContent(contents[i].PersistString);
|
---|
| 594 | if (content == null)
|
---|
| 595 | content = new DummyContent();
|
---|
| 596 | content.DockHandler.DockPanel = dockPanel;
|
---|
| 597 | content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
|
---|
| 598 | content.DockHandler.IsHidden = true;
|
---|
| 599 | content.DockHandler.IsFloat = contents[i].IsFloat;
|
---|
| 600 | }
|
---|
| 601 |
|
---|
| 602 | // Create panes
|
---|
| 603 | for (int i = 0; i < panes.Length; i++)
|
---|
| 604 | {
|
---|
| 605 | DockPane pane = null;
|
---|
| 606 | for (int j = 0; j < panes[i].IndexContents.Length; j++)
|
---|
| 607 | {
|
---|
| 608 | IDockContent content = dockPanel.Contents[panes[i].IndexContents[j]];
|
---|
| 609 | if (j == 0)
|
---|
| 610 | pane = dockPanel.DockPaneFactory.CreateDockPane(content, panes[i].DockState, false);
|
---|
| 611 | else if (panes[i].DockState == DockState.Float)
|
---|
| 612 | content.DockHandler.FloatPane = pane;
|
---|
| 613 | else
|
---|
| 614 | content.DockHandler.PanelPane = pane;
|
---|
| 615 | }
|
---|
| 616 | }
|
---|
| 617 |
|
---|
| 618 | // Assign Panes to DockWindows
|
---|
| 619 | for (int i = 0; i < dockWindows.Length; i++)
|
---|
| 620 | {
|
---|
| 621 | for (int j = 0; j < dockWindows[i].NestedPanes.Length; j++)
|
---|
| 622 | {
|
---|
| 623 | DockWindow dw = dockPanel.DockWindows[dockWindows[i].DockState];
|
---|
| 624 | int indexPane = dockWindows[i].NestedPanes[j].IndexPane;
|
---|
| 625 | DockPane pane = dockPanel.Panes[indexPane];
|
---|
| 626 | int indexPrevPane = dockWindows[i].NestedPanes[j].IndexPrevPane;
|
---|
| 627 | DockPane prevPane = (indexPrevPane == -1) ? dw.NestedPanes.GetDefaultPreviousPane(pane) : dockPanel.Panes[indexPrevPane];
|
---|
| 628 | DockAlignment alignment = dockWindows[i].NestedPanes[j].Alignment;
|
---|
| 629 | double proportion = dockWindows[i].NestedPanes[j].Proportion;
|
---|
| 630 | pane.DockTo(dw, prevPane, alignment, proportion);
|
---|
| 631 | if (panes[indexPane].DockState == dw.DockState)
|
---|
| 632 | panes[indexPane].ZOrderIndex = dockWindows[i].ZOrderIndex;
|
---|
| 633 | }
|
---|
| 634 | }
|
---|
| 635 |
|
---|
| 636 | // Create float windows
|
---|
| 637 | for (int i = 0; i < floatWindows.Length; i++)
|
---|
| 638 | {
|
---|
| 639 | FloatWindow fw = null;
|
---|
| 640 | for (int j = 0; j < floatWindows[i].NestedPanes.Length; j++)
|
---|
| 641 | {
|
---|
| 642 | int indexPane = floatWindows[i].NestedPanes[j].IndexPane;
|
---|
| 643 | DockPane pane = dockPanel.Panes[indexPane];
|
---|
| 644 | if (j == 0)
|
---|
| 645 | fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds);
|
---|
| 646 | else
|
---|
| 647 | {
|
---|
| 648 | int indexPrevPane = floatWindows[i].NestedPanes[j].IndexPrevPane;
|
---|
| 649 | DockPane prevPane = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane];
|
---|
| 650 | DockAlignment alignment = floatWindows[i].NestedPanes[j].Alignment;
|
---|
| 651 | double proportion = floatWindows[i].NestedPanes[j].Proportion;
|
---|
| 652 | pane.DockTo(fw, prevPane, alignment, proportion);
|
---|
| 653 | }
|
---|
| 654 |
|
---|
| 655 | if (panes[indexPane].DockState == fw.DockState)
|
---|
| 656 | panes[indexPane].ZOrderIndex = floatWindows[i].ZOrderIndex;
|
---|
| 657 | }
|
---|
| 658 | }
|
---|
| 659 |
|
---|
| 660 | // sort IDockContent by its Pane's ZOrder
|
---|
| 661 | int[] sortedContents = null;
|
---|
| 662 | if (contents.Length > 0)
|
---|
| 663 | {
|
---|
| 664 | sortedContents = new int[contents.Length];
|
---|
| 665 | for (int i = 0; i < contents.Length; i++)
|
---|
| 666 | sortedContents[i] = i;
|
---|
| 667 |
|
---|
| 668 | int lastDocument = contents.Length;
|
---|
| 669 | for (int i = 0; i < contents.Length - 1; i++)
|
---|
| 670 | {
|
---|
| 671 | for (int j = i + 1; j < contents.Length; j++)
|
---|
| 672 | {
|
---|
| 673 | DockPane pane1 = dockPanel.Contents[sortedContents[i]].DockHandler.Pane;
|
---|
| 674 | int ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex;
|
---|
| 675 | DockPane pane2 = dockPanel.Contents[sortedContents[j]].DockHandler.Pane;
|
---|
| 676 | int ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex;
|
---|
| 677 | if (ZOrderIndex1 > ZOrderIndex2)
|
---|
| 678 | {
|
---|
| 679 | int temp = sortedContents[i];
|
---|
| 680 | sortedContents[i] = sortedContents[j];
|
---|
| 681 | sortedContents[j] = temp;
|
---|
| 682 | }
|
---|
| 683 | }
|
---|
| 684 | }
|
---|
| 685 | }
|
---|
| 686 |
|
---|
| 687 | // show non-document IDockContent first to avoid screen flickers
|
---|
| 688 | for (int i = 0; i < contents.Length; i++)
|
---|
| 689 | {
|
---|
| 690 | IDockContent content = dockPanel.Contents[sortedContents[i]];
|
---|
| 691 | if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState != DockState.Document)
|
---|
| 692 | content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
|
---|
| 693 | }
|
---|
| 694 |
|
---|
| 695 | // after all non-document IDockContent, show document IDockContent
|
---|
| 696 | for (int i = 0; i < contents.Length; i++)
|
---|
| 697 | {
|
---|
| 698 | IDockContent content = dockPanel.Contents[sortedContents[i]];
|
---|
| 699 | if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState == DockState.Document)
|
---|
| 700 | content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
|
---|
| 701 | }
|
---|
| 702 |
|
---|
| 703 | for (int i = 0; i < panes.Length; i++)
|
---|
| 704 | dockPanel.Panes[i].ActiveContent = panes[i].IndexActiveContent == -1 ? null : dockPanel.Contents[panes[i].IndexActiveContent];
|
---|
| 705 |
|
---|
| 706 | if (dockPanelStruct.IndexActiveDocumentPane != -1)
|
---|
| 707 | dockPanel.Panes[dockPanelStruct.IndexActiveDocumentPane].Activate();
|
---|
| 708 |
|
---|
| 709 | if (dockPanelStruct.IndexActivePane != -1)
|
---|
| 710 | dockPanel.Panes[dockPanelStruct.IndexActivePane].Activate();
|
---|
| 711 |
|
---|
| 712 | for (int i = dockPanel.Contents.Count - 1; i >= 0; i--)
|
---|
| 713 | if (dockPanel.Contents[i] is DummyContent)
|
---|
| 714 | dockPanel.Contents[i].DockHandler.Form.Close();
|
---|
| 715 |
|
---|
| 716 | dockPanel.ResumeLayout(true, true);
|
---|
| 717 | }
|
---|
| 718 |
|
---|
| 719 | private static bool MoveToNextElement(XmlTextReader xmlIn)
|
---|
| 720 | {
|
---|
| 721 | if (!xmlIn.Read())
|
---|
| 722 | return false;
|
---|
| 723 |
|
---|
| 724 | while (xmlIn.NodeType == XmlNodeType.EndElement)
|
---|
| 725 | {
|
---|
| 726 | if (!xmlIn.Read())
|
---|
| 727 | return false;
|
---|
| 728 | }
|
---|
| 729 |
|
---|
| 730 | return true;
|
---|
| 731 | }
|
---|
| 732 |
|
---|
| 733 | private static bool IsFormatVersionValid(string formatVersion)
|
---|
| 734 | {
|
---|
| 735 | if (formatVersion == ConfigFileVersion)
|
---|
| 736 | return true;
|
---|
| 737 |
|
---|
| 738 | foreach (string s in CompatibleConfigFileVersions)
|
---|
| 739 | if (s == formatVersion)
|
---|
| 740 | return true;
|
---|
| 741 |
|
---|
| 742 | return false;
|
---|
| 743 | }
|
---|
| 744 | }
|
---|
| 745 |
|
---|
| 746 | public void SaveAsXml(string fileName)
|
---|
| 747 | {
|
---|
| 748 | Persistor.SaveAsXml(this, fileName);
|
---|
| 749 | }
|
---|
| 750 |
|
---|
| 751 | public void SaveAsXml(string fileName, Encoding encoding)
|
---|
| 752 | {
|
---|
| 753 | Persistor.SaveAsXml(this, fileName, encoding);
|
---|
| 754 | }
|
---|
| 755 |
|
---|
| 756 | public void SaveAsXml(Stream stream, Encoding encoding)
|
---|
| 757 | {
|
---|
| 758 | Persistor.SaveAsXml(this, stream, encoding);
|
---|
| 759 | }
|
---|
| 760 |
|
---|
| 761 | public void SaveAsXml(Stream stream, Encoding encoding, bool upstream)
|
---|
| 762 | {
|
---|
| 763 | Persistor.SaveAsXml(this, stream, encoding, upstream);
|
---|
| 764 | }
|
---|
| 765 |
|
---|
| 766 | public void LoadFromXml(string fileName, DeserializeDockContent deserializeContent)
|
---|
| 767 | {
|
---|
| 768 | Persistor.LoadFromXml(this, fileName, deserializeContent);
|
---|
| 769 | }
|
---|
| 770 |
|
---|
| 771 | public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent)
|
---|
| 772 | {
|
---|
| 773 | Persistor.LoadFromXml(this, stream, deserializeContent);
|
---|
| 774 | }
|
---|
| 775 |
|
---|
| 776 | public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
|
---|
| 777 | {
|
---|
| 778 | Persistor.LoadFromXml(this, stream, deserializeContent, closeStream);
|
---|
| 779 | }
|
---|
| 780 | }
|
---|
| 781 | }
|
---|