本文整理汇总了C#中TagList.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# TagList.Sort方法的具体用法?C# TagList.Sort怎么用?C# TagList.Sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagList
的用法示例。
在下文中一共展示了TagList.Sort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
//LabelMain.Text = GetContent("Body");
LiteralPageTitle.Text = FormatPageTitle("Sermon Archive");
LabelRightSideBarArea.Text = "<span class=\"title\">Archives</span><br />";
TagList pageTagList = null;
List<Document> SideBarList = null;
List<Document> DocumentList = null;
if (null == Session["EditRiverValleyMedia"])
{
DocumentList = Cache.Get("cache.RiverValley.MultimediaFiles") as List<Document>;
SideBarList = Cache.Get("cache.RiverValley.MultimediaSideBar") as List<Document>;
pageTagList = Cache.Get("cache.RiverValley.MultimediaTagList") as TagList;
}
if ((null == DocumentList) ||
(null == SideBarList) ||
(null == pageTagList))
{//Means that there is no cache read everything from disk
#region ReadLoop
DocumentList = new List<Document>();
SideBarList = new List<Document>();
pageTagList = new TagList();
DirectoryInfo directoryInfo = new DirectoryInfo(Server.MapPath(Document.MULTIMEDIA_FOLDER));
List<FileInfo> multimediaFileList = new List<FileInfo>();
multimediaFileList.AddRange(directoryInfo.GetFiles("*.mp3"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.wma"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.aac"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.ac3"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.mp4"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.wmv"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.mpg"));
Document doc;
System.Collections.Hashtable ht2 = new System.Collections.Hashtable();
foreach (FileInfo file in multimediaFileList)
{
try
{
if ((file.Extension.ToLower() == ".mp4") || (file.Extension.ToLower() == ".wmv") || (file.Extension.ToLower() == ".mpg"))
doc = new VideoFile(this, file.Name);
else
doc = new AudioFile(this, file.Name);
foreach (Tag t in doc.Tags)
{
pageTagList.Add(t);
}
//doc.Link = Document.MULTIMEDIA_FOLDER + "/" + doc.Name;
doc.Link = doc.Name;
}
catch { continue; }
DocumentList.Add(doc);
#region Fill RightSideBar
if (null == SideBarList.Find(delegate(Document st) { return ((st.Dated.Year == doc.Dated.Year) && (st.Dated.Month == doc.Dated.Month)); }))
{
SideBarList.Add(doc);
}
#endregion
}
#endregion
#region Sort
//Sort by date - sort should always be done after all filters for performance
DocumentList.Sort(delegate(Document f1, Document f2)
{
return DateTime.Compare(f2.Dated, f1.Dated);
});
//Do the same for right side bar
SideBarList.Sort(delegate(Document f1, Document f2)
{
return DateTime.Compare(f2.Dated, f1.Dated);
});
//And left
pageTagList.Sort(delegate(ListedTag t1, ListedTag t2)
{
return t1.Name.CompareTo(t2.Name);
});
#endregion
#region Insert Cache
//.........这里部分代码省略.........
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
LabelMain.Text = GetContent("Body");
LabelRightSideBarArea.Text = "<span class=\"subtitle\">By Month</span><br />";
TagList pageTagList = null;
List<Document> SideBarList = null;
List<Document> DocumentList = null;
if (null == Session["EditjudekGallery"])
{
DocumentList = Cache.Get("cache.judek.MultimediaFiles") as List<Document>;
SideBarList = Cache.Get("cache.judek.MultimediaSideBar") as List<Document>;
pageTagList = Cache.Get("cache.judek.MultimediaTagList") as TagList;
}
if ((null == DocumentList) ||
(null == SideBarList) ||
(null == pageTagList))
{//Means that there is no cache read everything from disk
#region ReadLoop
DocumentList = new List<Document>();
SideBarList = new List<Document>();
pageTagList = new TagList();
DirectoryInfo directoryInfo = new DirectoryInfo(Server.MapPath(Document.MULTIMEDIA_FOLDER));
List<FileInfo> multimediaFileList = new List<FileInfo>();
multimediaFileList.AddRange(directoryInfo.GetFiles("*.mp3"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.wma"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.aac"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.ac3"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.mp4"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.wmv"));
multimediaFileList.AddRange(directoryInfo.GetFiles("*.mpg"));
Document doc;
System.Collections.Hashtable ht2 = new System.Collections.Hashtable();
foreach (FileInfo file in multimediaFileList)
{
try
{
if ((file.Extension.ToLower() == ".mp4") || (file.Extension.ToLower() == ".wmv") || (file.Extension.ToLower() == ".mpg"))
doc = new VideoFile(this, file.Name);
else
doc = new AudioFile(this, file.Name);
foreach (Tag t in doc.Tags)
{
pageTagList.Add(t);
}
//doc.Link = Document.MULTIMEDIA_FOLDER + "/" + doc.Name;
doc.Link = doc.Name;
}
catch { continue; }
DocumentList.Add(doc);
#region Fill RightSideBar
if (null == SideBarList.Find(delegate(Document st) { return ((st.Dated.Year == doc.Dated.Year) && (st.Dated.Month == doc.Dated.Month)); }))
{
SideBarList.Add(doc);
}
#endregion
}
#endregion
#region Sort
//Sort by date - sort should always be done after all filters for performance
DocumentList.Sort(delegate(Document f1, Document f2)
{
return DateTime.Compare(f2.Dated, f1.Dated);
});
//Do the same for right side bar
SideBarList.Sort(delegate(Document f1, Document f2)
{
return DateTime.Compare(f2.Dated, f1.Dated);
});
//And left
pageTagList.Sort(delegate(ListedTag t1, ListedTag t2)
{
return t1.Name.CompareTo(t2.Name);
});
#endregion
#region Insert Cache
//Fill the cache with newly read info.
//.........这里部分代码省略.........