DocumentTabService(IDocumentTabUIContextLocatorProvider documentTabUIContextLocatorProvider, DocumentTreeView documentTreeView, ITabServiceProvider tabServiceProvider, IDocumentTabContentFactoryService documentTabContentFactoryService, IDocumentTabServiceSettings documentTabServiceSettings, IWpfFocusService wpfFocusService, IDecompilationCache decompilationCache, [ImportMany] IEnumerable <Lazy <IReferenceDocumentTabContentProvider, IReferenceDocumentTabContentProviderMetadata> > referenceDocumentTabContentProviders, [ImportMany] IEnumerable <Lazy <IDefaultDocumentTabContentProvider, IDefaultDocumentTabContentProviderMetadata> > defaultDocumentTabContentProviders, [ImportMany] IEnumerable <Lazy <IReferenceHandler, IReferenceHandlerMetadata> > referenceHandlers) { Settings = documentTabServiceSettings; this.documentTabUIContextLocatorProvider = documentTabUIContextLocatorProvider; this.documentTabContentFactoryService = documentTabContentFactoryService; this.wpfFocusService = wpfFocusService; this.decompilationCache = decompilationCache; this.referenceDocumentTabContentProviders = referenceDocumentTabContentProviders.OrderBy(a => a.Metadata.Order).ToArray(); this.defaultDocumentTabContentProviders = defaultDocumentTabContentProviders.OrderBy(a => a.Metadata.Order).ToArray(); this.referenceHandlers = referenceHandlers.OrderBy(a => a.Metadata.Order).ToArray(); var tvElem = documentTreeView.TreeView.UIObject; tvElem.IsVisibleChanged += TreeView_IsVisibleChanged; isTreeViewVisible = tvElem.IsVisible; DocumentTreeView = documentTreeView; DocumentTreeView.DocumentService.CollectionChanged += DocumentService_CollectionChanged; DocumentTreeView.SelectionChanged += DocumentTreeView_SelectionChanged; DocumentTreeView.NodesTextChanged += DocumentTreeView_NodesTextChanged; DocumentTreeView.NodeActivated += DocumentTreeView_NodeActivated; DocumentTreeView.TreeView.NodeRemoved += TreeView_NodeRemoved; tabService = tabServiceProvider.Create(); TabGroupService = tabService.Create(new TabGroupServiceOptions(MenuConstants.GUIDOBJ_DOCUMENTS_TABCONTROL_GUID)); TabGroupService.TabSelectionChanged += TabGroupService_TabSelectionChanged; TabGroupService.TabGroupSelectionChanged += TabGroupService_TabGroupSelectionChanged; }
public static SerializedTab TryCreate(IDocumentTabContentFactoryService documentTabContentFactoryService, IDocumentTab tab) { var contentSect = new SettingsSection(CONTENT_SECTION); var guid = documentTabContentFactoryService.Serialize(tab.Content, contentSect); if (guid == null) { return(null); } contentSect.Attribute(CONTENT_GUID_ATTR, guid.Value); var uiSect = new SettingsSection(UI_SECTION); tab.UIContext.SerializeUIState(uiSect, tab.UIContext.CreateUIState()); var tabUISect = new SettingsSection(TAB_UI_SECTION); tab.SerializeUI(tabUISect); var paths = new List <SerializedPath>(); foreach (var node in tab.Content.Nodes) { paths.Add(SerializedPath.Create(node)); } var autoLoadedDocuments = new List <DsDocumentInfo>(); foreach (var f in GetAutoLoadedDocuments(tab.Content.Nodes)) { autoLoadedDocuments.Add(f); } return(new SerializedTab(contentSect, tabUISect, uiSect, paths, autoLoadedDocuments)); }
public IEnumerable <object> Restore(DocumentTabService documentTabService, IDocumentTabContentFactoryService documentTabContentFactoryService, ITabGroupService mgr) { mgr.IsHorizontal = IsHorizontal; for (int i = 0; i < TabGroups.Count; i++) { var stg = TabGroups[i]; var g = i == 0 ? mgr.ActiveTabGroup ?? mgr.Create() : mgr.Create(); yield return(null); foreach (var o in stg.Restore(documentTabService, documentTabContentFactoryService, g)) { yield return(o); } } if (StackedContentState != null) { ((TabGroupService)mgr).StackedContentState = StackedContentState; } var ary = mgr.TabGroups.ToArray(); if ((uint)Index < (uint)ary.Length) { mgr.ActiveTabGroup = ary[Index]; } yield return(null); }
public static SerializedTabGroupWindow Create(IDocumentTabContentFactoryService factory, ITabGroupService tabGroupService, string name) { int index = tabGroupService.TabGroups.ToList().IndexOf(tabGroupService.ActiveTabGroup); var stackedContentState = ((TabGroupService)tabGroupService).StackedContentState; var tgw = new SerializedTabGroupWindow(name, index, tabGroupService.IsHorizontal, stackedContentState); foreach (var g in tabGroupService.TabGroups) tgw.TabGroups.Add(SerializedTabGroup.Create(factory, g)); return tgw; }
public static SerializedTabGroupWindow Create(IDocumentTabContentFactoryService factory, ITabGroupService tabGroupService, string name) { int index = tabGroupService.TabGroups.ToList().IndexOf(tabGroupService.ActiveTabGroup); var stackedContentState = ((TabGroupService)tabGroupService).StackedContentState; var tgw = new SerializedTabGroupWindow(name, index, tabGroupService.IsHorizontal, stackedContentState); foreach (var g in tabGroupService.TabGroups) { tgw.TabGroups.Add(SerializedTabGroup.Create(factory, g)); } return(tgw); }
public static SerializedTabGroup Create(IDocumentTabContentFactoryService documentTabContentFactoryService, ITabGroup g) { int index = g.TabContents.ToList().IndexOf(g.ActiveTabContent); var tg = new SerializedTabGroup(index); foreach (IDocumentTab tab in g.TabContents) { var t = SerializedTab.TryCreate(documentTabContentFactoryService, tab); if (t != null) { tg.Tabs.Add(t); } } return(tg); }
public IEnumerable <object> Restore(DocumentTabService documentTabService, IDocumentTabContentFactoryService documentTabContentFactoryService, ITabGroup g) { foreach (var st in Tabs) { foreach (var o in st.TryRestore(documentTabService, documentTabContentFactoryService, g)) { yield return(o); } } var ary = g.TabContents.ToArray(); if ((uint)Index < (uint)ary.Length) { g.ActiveTabContent = ary[Index]; } yield return(null); }
DocumentTabSerializer(IDocumentTabContentFactoryService documentTabContentFactoryService, DocumentTabService documentTabService) { this.documentTabContentFactoryService = documentTabContentFactoryService; this.documentTabService = documentTabService; }
DocumentTabSerializer(IDocumentTabContentFactoryService documentTabContentFactoryService, DocumentTabService documentTabService) { this.documentTabContentFactoryService = documentTabContentFactoryService; this.documentTabService = documentTabService; }
public IEnumerable <object> TryRestore(DocumentTabService documentTabService, IDocumentTabContentFactoryService documentTabContentFactoryService, 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, documentTabService.DocumentTreeView)) { yield return(o); } if (ctx.Nodes == null) { yield break; } var tabContent = documentTabContentFactoryService.Deserialize(guid.Value, Content, ctx.Nodes); yield return(null); if (tabContent == null) { yield break; } documentTabService.Add(g, tabContent, null, (Action <ShowTabContentEventArgs>)(a => { if (a.Success) { var uiContext = tabContent.DocumentTab.UIContext; tabContent.DocumentTab.DeserializeUI((ISettingsSection)TabUI); var obj = uiContext.DeserializeUIState(UI); uiContext.RestoreUIState(obj); } })); yield return(null); }
public static SerializedTabGroup Create(IDocumentTabContentFactoryService documentTabContentFactoryService, ITabGroup g) { int index = g.TabContents.ToList().IndexOf(g.ActiveTabContent); var tg = new SerializedTabGroup(index); foreach (IDocumentTab tab in g.TabContents) { var t = SerializedTab.TryCreate(documentTabContentFactoryService, tab); if (t != null) tg.Tabs.Add(t); } return tg; }
public IEnumerable<object> Restore(DocumentTabService documentTabService, IDocumentTabContentFactoryService documentTabContentFactoryService, ITabGroupService mgr) { mgr.IsHorizontal = IsHorizontal; for (int i = 0; i < TabGroups.Count; i++) { var stg = TabGroups[i]; var g = i == 0 ? mgr.ActiveTabGroup ?? mgr.Create() : mgr.Create(); yield return null; foreach (var o in stg.Restore(documentTabService, documentTabContentFactoryService, g)) yield return o; } if (StackedContentState != null) ((TabGroupService)mgr).StackedContentState = StackedContentState; var ary = mgr.TabGroups.ToArray(); if ((uint)Index < (uint)ary.Length) mgr.ActiveTabGroup = ary[Index]; yield return null; }
public IEnumerable<object> TryRestore(DocumentTabService documentTabService, IDocumentTabContentFactoryService documentTabContentFactoryService, 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, documentTabService.DocumentTreeView)) yield return o; if (ctx.Nodes == null) yield break; var tabContent = documentTabContentFactoryService.Deserialize(guid.Value, Content, ctx.Nodes); yield return null; if (tabContent == null) yield break; documentTabService.Add(g, tabContent, null, (Action<ShowTabContentEventArgs>)(a => { if (a.Success) { var uiContext = tabContent.DocumentTab.UIContext; tabContent.DocumentTab.DeserializeUI((ISettingsSection)TabUI); var obj = uiContext.DeserializeUIState(UI); uiContext.RestoreUIState(obj); } })); yield return null; }
public static SerializedTab TryCreate(IDocumentTabContentFactoryService documentTabContentFactoryService, IDocumentTab tab) { var contentSect = new SettingsSection(CONTENT_SECTION); var guid = documentTabContentFactoryService.Serialize(tab.Content, contentSect); if (guid == null) return null; contentSect.Attribute(CONTENT_GUID_ATTR, guid.Value); var uiSect = new SettingsSection(UI_SECTION); tab.UIContext.SerializeUIState(uiSect, tab.UIContext.CreateUIState()); var tabUISect = new SettingsSection(TAB_UI_SECTION); tab.SerializeUI(tabUISect); var paths = new List<SerializedPath>(); foreach (var node in tab.Content.Nodes) paths.Add(SerializedPath.Create(node)); var autoLoadedDocuments = new List<DsDocumentInfo>(); foreach (var f in GetAutoLoadedDocuments(tab.Content.Nodes)) autoLoadedDocuments.Add(f); return new SerializedTab(contentSect, tabUISect, uiSect, paths, autoLoadedDocuments); }
public IEnumerable<object> Restore(DocumentTabService documentTabService, IDocumentTabContentFactoryService documentTabContentFactoryService, ITabGroup g) { foreach (var st in Tabs) { foreach (var o in st.TryRestore(documentTabService, documentTabContentFactoryService, g)) yield return o; } var ary = g.TabContents.ToArray(); if ((uint)Index < (uint)ary.Length) g.ActiveTabContent = ary[Index]; yield return null; }
NodeReferenceDocumentTabContentProvider(IDocumentTabContentFactoryService documentTabContentFactoryService, IDocumentTreeView documentTreeView) { this.documentTabContentFactoryService = documentTabContentFactoryService; this.documentTreeView = documentTreeView; }
DefaultDocumentTabContentProvider(IDocumentTabContentFactoryService documentTabContentFactoryService) => this.documentTabContentFactoryService = documentTabContentFactoryService;
NodeReferenceDocumentTabContentProvider(IDocumentTabContentFactoryService documentTabContentFactoryService, IDocumentTreeView documentTreeView) { this.documentTabContentFactoryService = documentTabContentFactoryService; this.documentTreeView = documentTreeView; }