public ITabContentLifetimeHost RestoreTabContent(LayoutStructureTabItem tabItem) { var connectionPropVal = tabItem.ReadProperty(ConnectionIdBackingStorePropertyName); Guid connectionId; ExplicitConnection explicitConnection = null; if (connectionPropVal != null && Guid.TryParse(connectionPropVal, out connectionId)) { explicitConnection = _container.GetInstance <IExplicitConnectionCache>().Get(connectionId).ValueOrDefault(); } var fileIdPropVal = tabItem.ReadProperty(FileIdBackingStorePropertyName); Guid fileId; if (fileIdPropVal == null || !Guid.TryParse(fileIdPropVal, out fileId)) { fileId = Guid.NewGuid(); } var explicitArguments = new ExplicitArguments(); explicitArguments.Set(typeof(Guid), fileId); explicitArguments.Set(typeof(ExplicitConnection), explicitConnection); var tabViewModel = _container.GetInstance <QueryDeveloperViewModel>(explicitArguments); PopulateDocument(tabViewModel); var disposable = Watch(tabViewModel); return(new TabContentLifetimeHost(tabViewModel, closeReason => Cleanup(closeReason, tabViewModel, disposable))); }
public ITabContentLifetimeHost RestoreTabContent(LayoutStructureTabItem tabItem) { var managementViewModel = _container.GetInstance <ManagementViewModel>(); return(new TabContentLifetimeHost(managementViewModel, reason => managementViewModel.Dispose())); }