Пример #1
0
        public List <SerializedTabGroupWindow> SaveTabs()
        {
            var tgws = new List <SerializedTabGroupWindow>();

            tgws.Add(SerializedTabGroupWindow.Create(documentTabContentFactoryService, documentTabService.TabGroupService, SerializedTabGroupWindow.MAIN_NAME));
            return(tgws);
        }
Пример #2
0
		IEnumerable<DsDocumentInfo> GetAutoLoadedAssemblies(SerializedTabGroupWindow tgw) {
			foreach (var g in tgw.TabGroups) {
				foreach (var t in g.Tabs) {
					foreach (var f in t.AutoLoadedDocuments)
						yield return f;
				}
			}
		}
Пример #3
0
		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;
		}
Пример #4
0
		public static SerializedTabGroupWindow Load(ISettingsSection section) {
			var name = section.Attribute<string>(NAME_ATTR) ?? MAIN_NAME;
			int index = section.Attribute<int?>(INDEX_ATTR) ?? -1;
			bool isHorizontal = section.Attribute<bool?>(ISHORIZONTAL_ATTR) ?? false;
			var stackedContentState = StackedContentStateSerializer.TryDeserialize(section.GetOrCreateSection(STACKEDCONTENTSTATE_SECTION));
			var tgw = new SerializedTabGroupWindow(name, index, isHorizontal, stackedContentState);

			foreach (var tgSection in section.SectionsWithName(TABGROUP_SECTION))
				tgw.TabGroups.Add(SerializedTabGroup.Load(tgSection));

			return tgw;
		}
Пример #5
0
		IEnumerable<object> Load(SerializedTabGroupWindow tgw) {
			bool addedAutoLoadedAssembly = false;
			foreach (var f in GetAutoLoadedAssemblies(tgw)) {
				addedAutoLoadedAssembly = true;
				documentTabService.DocumentTreeView.DocumentService.TryGetOrCreate(f, true);
				yield return null;
			}
			if (addedAutoLoadedAssembly)
				yield return LoaderConstants.Delay;

			foreach (var o in tgw.Restore(documentTabService, documentTabContentFactoryService, documentTabService.TabGroupService))
				yield return o;
		}
Пример #6
0
 IEnumerable <DsDocumentInfo> GetAutoLoadedAssemblies(SerializedTabGroupWindow tgw)
 {
     foreach (var g in tgw.TabGroups)
     {
         foreach (var t in g.Tabs)
         {
             foreach (var f in t.AutoLoadedDocuments)
             {
                 yield return(f);
             }
         }
     }
 }
Пример #7
0
        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);
        }
Пример #8
0
        public static SerializedTabGroupWindow Load(ISettingsSection section)
        {
            var  name                = section.Attribute <string>(NAME_ATTR) ?? MAIN_NAME;
            int  index               = section.Attribute <int?>(INDEX_ATTR) ?? -1;
            bool isHorizontal        = section.Attribute <bool?>(ISHORIZONTAL_ATTR) ?? false;
            var  stackedContentState = StackedContentStateSerializer.TryDeserialize(section.GetOrCreateSection(STACKEDCONTENTSTATE_SECTION));
            var  tgw = new SerializedTabGroupWindow(name, index, isHorizontal, stackedContentState);

            foreach (var tgSection in section.SectionsWithName(TABGROUP_SECTION))
            {
                tgw.TabGroups.Add(SerializedTabGroup.Load(tgSection));
            }

            return(tgw);
        }
Пример #9
0
        IEnumerable <object> Load(SerializedTabGroupWindow tgw)
        {
            bool addedAutoLoadedAssembly = false;

            foreach (var f in GetAutoLoadedAssemblies(tgw))
            {
                addedAutoLoadedAssembly = true;
                documentTabService.DocumentTreeView.DocumentService.TryGetOrCreate(f, true);
                yield return(null);
            }
            if (addedAutoLoadedAssembly)
            {
                yield return(LoaderConstants.Delay);
            }

            foreach (var o in tgw.Restore(documentTabService, documentTabContentFactoryService, documentTabService.TabGroupService))
            {
                yield return(o);
            }
        }
Пример #10
0
        public IEnumerable <object> Load(ISettingsService settingsService, IAppCommandLineArgs args)
        {
            var section = settingsService.GetOrCreateSection(SETTINGS_GUID);

            foreach (var o in documentListLoader.Load(section.GetOrCreateSection(DOCUMENT_LISTS_SECTION), args.LoadFiles))
            {
                yield return(o);
            }

            if (args.LoadFiles)
            {
                var tgws     = new List <SerializedTabGroupWindow>();
                var tgwsHash = new HashSet <string>(StringComparer.Ordinal);
                foreach (var tgwSection in section.SectionsWithName(TABGROUPWINDOW_SECTION))
                {
                    var tgw = SerializedTabGroupWindow.Load(tgwSection);
                    yield return(null);

                    if (tgwsHash.Contains(tgw.Name))
                    {
                        continue;
                    }
                    tgws.Add(tgw);
                }

                // The documents are added to the treeview with a slight delay. Make sure the documents
                // have been added to the TV or the node lookup code will fail to find the nodes it needs.
                yield return(LoaderConstants.Delay);

                foreach (var o in documentTabSerializer.Restore(tgws))
                {
                    yield return(o);
                }
            }

            documentTabService.OnTabsLoaded();
        }