private AddShelfView ( |
||
shelfView | ||
control | ||
title | string | |
hint | ShelfDisplayHint | |
shelfRestoreStream | ||
return | Content |
/// <summary> /// Opens this shelf view. /// </summary> public override void Open() { IApplicationComponentView componentView = (IApplicationComponentView)ViewFactory.CreateAssociatedView(_shelf.Component.GetType()); componentView.SetComponent((IApplicationComponent)_shelf.Component); XmlDocument restoreDocument; if (DesktopViewSettings.Default.GetShelfState(_desktopView.DesktopWindowName, _shelf.Name, out restoreDocument)) { using (MemoryStream memoryStream = new MemoryStream()) { using (XmlTextWriter writer = new XmlTextWriter(memoryStream, Encoding.UTF8)) { restoreDocument.WriteContentTo(writer); writer.Flush(); memoryStream.Position = 0; _content = _desktopView.AddShelfView(this, (Control)componentView.GuiElement, _shelf.Title, _shelf.DisplayHint, memoryStream); writer.Close(); memoryStream.Close(); } } } else { _content = _desktopView.AddShelfView(this, (Control)componentView.GuiElement, _shelf.Title, _shelf.DisplayHint, null); } }