public IEnumerable<object> TryRestore(FileTabManager fileTabManager, IFileTabContentFactoryManager creator, ITabGroup g) { var guid = Content.Attribute<Guid?>(CONTENT_GUID_ATTR); if (guid == null) yield break; var ctx = new GetNodesContext(); foreach (var o in GetNodes(ctx, fileTabManager.FileTreeView)) yield return o; if (ctx.Nodes == null) yield break; var tabContent = creator.Deserialize(guid.Value, Content, ctx.Nodes); yield return null; if (tabContent == null) yield break; fileTabManager.Add(g, tabContent, null, a => { if (a.Success) { var uiContext = tabContent.FileTab.UIContext; tabContent.FileTab.DeserializeUI(TabUI); var obj = uiContext.CreateSerialized(UI); uiContext.Deserialize(obj); } }); yield return null; }
public IEnumerable <object> TryRestore(FileTabManager fileTabManager, IFileTabContentFactoryManager fileTabContentFactoryManager, ITabGroup g) { var guid = Content.Attribute <Guid?>(CONTENT_GUID_ATTR); if (guid == null) { yield break; } var ctx = new GetNodesContext(); foreach (var o in GetNodes(ctx, fileTabManager.FileTreeView)) { yield return(o); } if (ctx.Nodes == null) { yield break; } var tabContent = fileTabContentFactoryManager.Deserialize(guid.Value, Content, ctx.Nodes); yield return(null); if (tabContent == null) { yield break; } fileTabManager.Add(g, tabContent, null, (Action <ShowTabContentEventArgs>)(a => { if (a.Success) { var uiContext = tabContent.FileTab.UIContext; tabContent.FileTab.DeserializeUI((ISettingsSection)this.TabUI); var obj = uiContext.CreateSerialized(UI); uiContext.Deserialize(obj); } })); yield return(null); }