For debugging purposes, or in case of corruption, how can I reset LayoutManger's Layout to a virgin state? I tried deserializing from null and string.empty but neither works. Doing CloseAllDocuments and saving->restoring the layout didn't work as expected as some pads were still open.

asked 14 Sep '10, 14:59

BSalita's gravatar image

accept rate: 22%

edited 14 Sep '10, 15:03

FYI, CloseAllDocuments only closes documents, not pads. I'll look into how to get a "virgin" state.

(14 Sep '10, 21:31) Scott Whitlock ♦♦

Can you create an empty SoapBox Core application with no documents or pads, and create one StartupCommand add-in that just saves the layout? That blob should work for any restore layout command. Just call CloseAllDocuments and then HideAllPads, and then restore that blob.

(14 Sep '10, 21:44) Scott Whitlock ♦♦

Thanks. Your comments focused me on an easy solution. Before I do a RestoreLayout in LayoutLoaded, I now save the virgin layout. This should guarantee a restorable Layout even if the format of Layout changes.

<Import(SoapBox.Core.Services.Layout.LayoutManager, GetType(ILayoutManager))> _
Private Property layoutManager As Lazy(Of ILayoutManager)

Public Sub LayoutLoaded(ByVal sender As Object, ByVal e As EventArgs)
    My.Settings.VirginLayout = layoutManager.Value.SaveLayout
End Sub

Public Sub LayoutUnloading(ByVal sender As Object, ByVal e As EventArgs)
    My.Settings.LastUsedLayout = layoutManager.Value.SaveLayout()
End Sub

answered 15 Sep '10, 07:55

BSalita's gravatar image

accept rate: 22%

edited 15 Sep '10, 08:06

Documents and Pads work a little differently. Documents can be "closed" and they actually go away, but Pads are only hidden. The state of where they are always stays around. This is kind of an AvalonDock thing, but it makes sense because you usually want your tool windows to re-open where they originally were.

I think what we're missing here is an overload for ShowPad that takes a location as a parameter, like floating, docked-left, docked-right, etc. Right now all pads initially show up docked to the right, which is pretty annoying, and having this overload would fix the "where to go initially" problem too.

Alternatively we could add "default position" properties to IPad. Then ShowPad could have an overload with a "showAtDefaultLocation" parameter. It makes more sense for the pad itself to know it's default location, rather than whoever is calling ShowPad.


answered 14 Sep '10, 21:38

Scott%20Whitlock's gravatar image

Scott Whitlock ♦♦
accept rate: 50%

edited 14 Sep '10, 21:40

I would like the ability to position new pads including nesting them in (pre-defined) logical groups. I would like the ability for new pads to show floating on top the main window, ready to be dragged to a docking location.

(15 Sep '10, 05:23) BSalita
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 14 Sep '10, 14:59

Seen: 10,145 times

Last updated: 15 Sep '10, 08:06

powered by OSQA