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


C# AbsoluteTopicName.ToString方法代码示例

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


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

示例1: FormatRSSTopicHistory

		/// <summary>
		/// Answer the RSS topic history for a given topic
		/// </summary>
		/// <param name="topic"></param>
		/// <param name="useHTML"></param>
		/// <returns></returns>
		void FormatRSSTopicHistory(AbsoluteTopicName topic, bool useHTML, XmlWriter newsletter, IEnumerable changesForThisTopic)
		{
			ArrayList names = new ArrayList();
			Hashtable changeInfo = new Hashtable();		// key = author, value = TopicChange
			int count = 0;
			foreach (TopicChange change in changesForThisTopic)
			{
				if (count >= MaxChanges)
				{
					break;
				}
				count++;
				if (names.Contains(change.Author)) 
				{
					continue;
				}
				names.Add(change.Author);
				changeInfo[change.Author] = change;
			}

			if (count == 0) 
			{
				return;
			}

			if (useHTML)
			{
				Uri link = new Uri(TheLinkMaker.LinkToTopic(topic, true), false);
				newsletter.WriteStartElement("a");
				newsletter.WriteAttributeString("title", HTMLWriter.Escape(topic.Fullname));
				newsletter.WriteAttributeString("href", link.AbsoluteUri);
				newsletter.WriteString(HTMLWriter.Escape(topic.Name));
				newsletter.WriteEndElement();
			}
			else
			{
				newsletter.WriteString(HTMLWriter.Escape(topic.Name));
			}

			newsletter.WriteString(
				string.Format(" was most recently changed by: ")
				);

			bool firstName = true;

			if (useHTML)
			{
				newsletter.WriteStartElement("ul");
			}

			foreach (string eachAuthor in names)
			{
				if (useHTML)
				{
					newsletter.WriteStartElement("li");
				}
				else 
				{
					if (!firstName)
					{
						newsletter.WriteString(", ");
					}
				}
				firstName = false;

				newsletter.WriteString(HTMLWriter.Escape(eachAuthor) + " (" + ((TopicChange)(changeInfo[eachAuthor])).Timestamp.ToString() + ")");
				
				if(useHTML)
				{
					newsletter.WriteEndElement();
				}
			}	
			if (useHTML)
			{
				newsletter.WriteEndElement();
				Uri link = new Uri(TheLinkMaker.LinkToVersions(topic.ToString()), false);

				newsletter.WriteString("View the ");
				newsletter.WriteStartElement("a");
				newsletter.WriteAttributeString("title", "Versions for " + HTMLWriter.Escape(topic.Fullname));
				newsletter.WriteAttributeString("href", link.AbsoluteUri);
				newsletter.WriteString("complete version history");
				newsletter.WriteEndElement();

				newsletter.WriteStartElement("br");
				newsletter.WriteEndElement();
			}
			else
			{
				newsletter.WriteString("\n");
			}
			return;
		}
开发者ID:nuxleus,项目名称:flexwiki,代码行数:99,代码来源:Rss.aspx.cs


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