Quantcast
Channel: AvalonDock
Viewing all articles
Browse latest Browse all 2690

Commented Issue: Deserialization of Documents [15715]

$
0
0
I was testing the Deserialization of layouts in the AvalonDock.TestApp
my process was simply:
1. run the AvalonDock.TestApp project
2. Click on the "click to add 2 documents" button to create "Test1" and "Test2" documents in the document pane.
3. Layout Menu -> Save -> Layout1
4. Layout Menu -> Load -> Layout1

When the layout deserialized, Test1 and Test2 didnt exist, which made sense because i had given them a contentid. But even when i did it would not load them. They existed in the .config file that was serialized.

I dont know if this is by design or not but it wasn't what i was looking for so in the layoutSerializer.cs
line 117-120 i changed:
else if (previousDocument == null)
lcToFix.Close();
else
lcToFix.Content = previousDocument.Content;
To:
else if (previousDocument != null)
lcToFix.Content = previousDocument.Content;

and i got the functionality i was looking for. Test1 and Test2 showed up when i loaded the layout.
I dont know if that fix is the correct one, but i would suggest it if you want all your documents serialized from your input.
Comments: ** Comment from web user: cman122887 **

Had to add an else statement in layoutserializer.cs @ ~107 to keep the functionality that a contentId is necessary to deserialize.
102-111:
if (lcToFix.ContentId != null)
{
//try find the content in replaced layout
previousDocument = _previousDocuments.FirstOrDefault(a => a.ContentId == lcToFix.ContentId);
}
else
{
lcToFix.Close();
continue;
}


Viewing all articles
Browse latest Browse all 2690

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>