当前位置: 首页>>代码示例>>C#>>正文


C# ItemList.Sort方法代码示例

本文整理汇总了C#中ItemList.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# ItemList.Sort方法的具体用法?C# ItemList.Sort怎么用?C# ItemList.Sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemList的用法示例。


在下文中一共展示了ItemList.Sort方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetChildren

        private IEnumerable<ContentItem> GetChildren(bool getPages)
        {
            var items = new ItemList();
            foreach (var parent in gateway.FindTranslations(Selection.SelectedItem))
            {
	            if (getPages)
	            {
		            foreach (ContentItem child in parent.GetChildPagesUnfiltered().Where(Engine.EditManager.GetEditorFilter(User)))
			            if (!items.ContainsAny(gateway.FindTranslations(child)))
				            items.Add(child);
	            }
	            else
	            {
					foreach (ContentItem child in parent.GetChildPartsUnfiltered().Where(Engine.EditManager.GetEditorFilter(User)))
						if (!items.ContainsAny(gateway.FindTranslations(child)))
							items.Add(child);
	            }
            }
            items.Sort();

            foreach (ContentItem item in items)
            {
	            if (item is ILanguage)
                    continue;
	            if (item.IsPage == getPages)
		            yield return item;
            }
        }
开发者ID:bherila,项目名称:n2cms,代码行数:28,代码来源:Default.aspx.cs

示例2: ReorderBy

		private IEnumerable<ContentItem> ReorderBy(ContentItem item, string sortExpression)
		{
			// Possible workaround of issue lazy-loading children 
			// List<T> takes some shortcuts that might bypass nh bag initialization
			ItemList temp = new ItemList(item.Children.Select(c => c));
			temp.Sort(sortExpression);
			
			item.Children.Clear();
			foreach (var child in temp)
				item.Children.Add(child);

			return Utility.UpdateSortOrder(temp);
		}
开发者ID:andy4711,项目名称:n2cms,代码行数:13,代码来源:SortChildrenAttribute.cs

示例3: GetChildren

		protected IEnumerable<ContentItem> GetChildren(bool getPages)
		{
			ItemList items = new ItemList();
			foreach (ContentItem parent in gateway.FindTranslations(Selection.SelectedItem))
			{
				foreach (ContentItem child in parent.GetChildren(Engine.EditManager.GetEditorFilter(User)))
				{
					if (!items.ContainsAny(gateway.FindTranslations(child)))
					{
						items.Add(child);
					}
				}
			}
			items.Sort();

			foreach (ContentItem item in items)
			{
				if (item is ILanguage)
					continue;
				else if (item.IsPage == getPages)
					yield return item;
			}
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:23,代码来源:Default.aspx.cs

示例4: LookForMissingEps

        public void LookForMissingEps(SetProgressDelegate prog)
        {
            // for each ep we have noticed as being missing
            // look through the monitored folders for it

            this.Stats().FindAndOrganisesDone++;

            prog.Invoke(0);

            ItemList newList = new ItemList();
            ItemList toRemove = new ItemList();

            int fileCount = 0;
            foreach (string s in this.SearchFolders)
                fileCount += DirCache.CountFiles(s, true);

            int c = 0;

            DirCache dirCache = new DirCache();
            foreach (String s in this.SearchFolders)
            {
                if (this.ActionCancel)
                    return;

                c = dirCache.AddFolder(prog, c, fileCount, s, true, this.Settings);
            }

            c = 0;
            int totalN = this.TheActionList.Count;
            foreach (Item action1 in this.TheActionList)
            {
                if (this.ActionCancel)
                    return;

                prog.Invoke(50 + 50 * (++c) / (totalN + 1)); // second 50% of progress bar

                if (action1 is ItemMissing)
                {
                    if (this.FindMissingEp(dirCache, (ItemMissing) (action1), newList, ActionCopyMoveRename.Op.Copy))
                        toRemove.Add(action1);
                }
            }

            if (this.Settings.KeepTogether)
                this.KeepTogether(newList);

            prog.Invoke(100);

            if (!this.Settings.LeaveOriginals)
            {
                // go through and change last of each operation on a given source file to a 'Move'
                // ideally do that move within same filesystem

                // sort based on source file, and destination drive, putting last if destdrive == sourcedrive
                newList.Sort(new ActionItemSorter());

                // sort puts all the CopyMoveRenames together

                // then set the last of each source file to be a move
                for (int i = 0; i < newList.Count; i++)
                {
                    ActionCopyMoveRename cmr1 = newList[i] as ActionCopyMoveRename;
                    bool ok1 = cmr1 != null;

                    if (!ok1)
                        continue;

                    bool last = i == (newList.Count - 1);
                    ActionCopyMoveRename cmr2 = !last ? newList[i + 1] as ActionCopyMoveRename : null;
                    bool ok2 = cmr2 != null;

                    if (ok2)
                    {
                        ActionCopyMoveRename a1 = cmr1;
                        ActionCopyMoveRename a2 = cmr2;
                        if (!Helpers.Same(a1.From, a2.From))
                            a1.Operation = ActionCopyMoveRename.Op.Move;
                    }
                    else
                    {
                        // last item, or last copymoverename item in the list
                        ActionCopyMoveRename a1 = cmr1;
                        a1.Operation = ActionCopyMoveRename.Op.Move;
                    }
                }
            }

            foreach (Item i in toRemove)
                this.TheActionList.Remove(i);

            foreach (Item i in newList)
                this.TheActionList.Add(i);

            //                 if (Settings->ExportFOXML)
            //				ExportFOXML(Settings->ExportFOXMLTo);
        }
开发者ID:mudboy,项目名称:tvrename,代码行数:96,代码来源:TVDoc.cs

示例5: GetSharedInfo


//.........这里部分代码省略.........
                    }
                    else
                    {
                        var u = CoreContext.UserManager.GetUsers(r.Subject);
                        var isgroup = false;
                        var title = u.DisplayUserName(false);

                        if (u.ID == ASC.Core.Users.Constants.LostUser.ID)
                        {
                            var g = CoreContext.GroupManager.GetGroupInfo(r.Subject);
                            isgroup = true;
                            title = g.Name;

                            if (g.ID == ASC.Core.Users.Constants.GroupAdmin.ID)
                                title = FilesCommonResource.Admin;
                            if (g.ID == ASC.Core.Users.Constants.GroupEveryone.ID)
                                title = FilesCommonResource.Everyone;

                            if (g.ID == ASC.Core.Users.Constants.LostGroupInfo.ID)
                            {
                                FileSecurity.RemoveSubject(r.Subject);
                                continue;
                            }
                        }

                        var w = new AceWrapper
                                    {
                                        SubjectId = r.Subject,
                                        SubjectName = title,
                                        SubjectGroup = isgroup,
                                        Share = r.Share,
                                        Owner =
                                            entry.RootFolderType == FolderType.USER
                                                ? entry.RootFolderCreator == r.Subject
                                                : entry.CreateBy == r.Subject,
                                    };
                        result.Add(w);
                    }
                }

                if (entryType == FileEntryType.File && !result.Any(w => w.SubjectId == FileConstant.ShareLinkId))
                {
                    var w = new AceWrapper
                                {
                                    SubjectId = FileConstant.ShareLinkId,
                                    SubjectName = DocumentUtils.GetShareLinkParam(entryId),
                                    SubjectGroup = true,
                                    Share = shareLink,
                                    Owner = false
                                };
                    result.Add(w);
                }

                if (!result.Any(w => w.Owner))
                {
                    var ownerId = entry.RootFolderType == FolderType.USER ? entry.RootFolderCreator : entry.CreateBy;
                    var w = new AceWrapper
                                {
                                    SubjectId = ownerId,
                                    SubjectName = FileEntry.GetUserName(ownerId),
                                    SubjectGroup = false,
                                    Share = FileShare.ReadWrite,
                                    Owner = true,
                                };
                    result.Add(w);
                }
                if (entry.RootFolderType == FolderType.COMMON)
                {
                    if (result.All(w => w.SubjectId != ASC.Core.Users.Constants.GroupAdmin.ID))
                    {
                        var w = new AceWrapper
                                    {
                                        SubjectId = ASC.Core.Users.Constants.GroupAdmin.ID,
                                        SubjectName = FilesCommonResource.Admin,
                                        SubjectGroup = true,
                                        Share = FileShare.ReadWrite,
                                        Owner = false,
                                        LockedRights = true,
                                    };
                        result.Add(w);
                    }
                    if (result.All(w => w.SubjectId != ASC.Core.Users.Constants.GroupEveryone.ID))
                    {
                        var w = new AceWrapper
                                    {
                                        SubjectId = ASC.Core.Users.Constants.GroupEveryone.ID,
                                        SubjectName = FilesCommonResource.Everyone,
                                        SubjectGroup = true,
                                        Share = FileSecurity.DefaultCommonShare,
                                        Owner = false,
                                    };
                        result.Add(w);
                    }
                }
            }

            result.Sort((x, y) => string.Compare(x.SubjectName, y.SubjectName));

            return result;
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:101,代码来源:Service.svc.cs

示例6: ReorderBy

        private IEnumerable<ContentItem> ReorderBy(ContentItem item, string sortExpression)
        {
            ItemList temp = new ItemList(item.Children);
            temp.Sort(sortExpression);

            item.Children.Clear();
            foreach (var child in temp)
                item.Children.Add(child);

            return Utility.UpdateSortOrder(temp);
        }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:11,代码来源:SortChildrenAttribute.cs


注:本文中的ItemList.Sort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。