本文整理汇总了C#中TagList类的典型用法代码示例。如果您正苦于以下问题:C# TagList类的具体用法?C# TagList怎么用?C# TagList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TagList类属于命名空间,在下文中一共展示了TagList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunTableExamples1
/////////////////////////////////////////////////////////////////////////////
static void RunTableExamples1( IEnumerable<string> items )
{
// ******
int index = 0;
string directory = string.Empty;
var tagList = new TagList { };
// ******
foreach( var example in TableExamples() ) {
var htmlPath = example.Item1;
var about = example.Item2;
if( 0 == index ) {
directory = Path.GetDirectoryName( htmlPath );
}
tagList.AddChild( new A( "file:///" + htmlPath ).SetValue( about ) );
}
//var div = new Div().AppendChildren( tagList );
var list = new Ul().AddListItems( tagList );
// ******
//var page = new SimplePage<SimpleHtml> { };
//page.AddBodyContent( tagList );
//var html = page.Html.Render();
var html = new BasicHtml( "Index" );
html.BodyContainer.AddChild( list );
var text = html.Render();
File.WriteAllText( Path.Combine( directory,"index.html" ), text );
}
示例2: LoadTasks
public void LoadTasks(TaskList taskList)
{
string[] lines = System.IO.File.ReadAllLines(@"List.txt");
foreach (string line in lines)
{
Task task = new Task();
var items = line.Split(';');
task.TaskDescription = items[1];
if (items[0] == "[X]")
{
task.IsDone = true;
}
task.IsNewTask = false;
task.TaskId = items[2];
task.DueDate = Convert.ToDateTime(items[3]);
task.DoneDate = Convert.ToDateTime(items[4]);
int i = items.Length;
TagList tags = new TagList();
while (i > 5)
{
Tag tag = new Tag(items[i - 1]);
tags.AddTag(ref tag);
i--;
}
task.TagList = tags;
taskList.AddTask(ref task);
}
}
示例3: LoadTags
public void LoadTags(ref TagList tags)
{
StreamReader tagFile = new StreamReader(@"Tags.xml");
XmlSerializer xs = new XmlSerializer(typeof(TagList));
tags = (TagList)xs.Deserialize(tagFile);
tagFile.Close();
}
示例4: SaveTags
public void SaveTags(TagList tags)
{
StreamWriter tagFile = new StreamWriter(@"Tags.xml");
XmlSerializer xs = new XmlSerializer(typeof(TagList));
xs.Serialize(tagFile, tags);
tagFile.Close();
}
示例5: Execute
public void Execute(ArgumentList arguments, TaskList tasklist, TagList tags, TagFolder folder)
{
ILister lister = new Lister();
if (arguments.GetParameter(arguments.GetLength() - 1) == "--export")
lister = new HtmlLister();
lister.ListFiltered(tasklist.FilterTasks(arguments.GetParameter(1)), arguments.GetParameter(1));
}
示例6: Load
public static void Load(string path)
{
var l = new TagList<TagString>();
if (File.Exists(path))
{
var t = File.ReadAllLines(path);
var p = "";
foreach (string s in t)
{
//New page
if (s == "\t----")
{
l.Add(new TagString(p));
p = "";
continue;
}
if (p == "")
p = s;
else
p = p + "\n" + s;
}
l.Add(new TagString(p));
} else
{
l.Add(new TagString("Rules not found"));
}
var c = new TagCompound();
c ["pages"] = l;
c ["title"] = new TagString("Rules");
Debug.WriteLine("Rules: " + c);
Content = c;
}
示例7: Build
/////////////////////////////////////////////////////////////////////////////
#region code
public Tuple<string, string> Build()
{
// ******
var tagList = new TagList { };
tagList.AddChild( new QuickTag( "h4" )
.SetValue( About ) );
// ******
var table = new Table( caption: "Money Flow", border: 0, id: "", attrAndStyles: "background : ivory" );
tagList.AddChild( table );
// ******
foreach( var item in AccountSummaryData.Create() ) {
table.AddBodyRow(
Content( item.Col1.ToString( "dd MMM yyyy" ), "width : 100px", "text-align : right" ),
Content( item.Col2.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col3.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col4.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col5.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col6.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col7.ToString(), "width : 100px", "text-align : right", item.Col7 < 0 ? "color : red" : "" )
);
}
// ******
return new Tuple<string, string>( Render( tagList ), nameof( TableWithFormatting2 ) );
}
示例8: AddListItems
/////////////////////////////////////////////////////////////////////////////
public ListBase AddListItems( TagList tags )
{
foreach( var tag in tags ) {
AddChild( new Li().AddChild( tag ) );
}
return this;
}
示例9: TagCache
/// <summary>
/// Opens a tags.dat file from a stream.
/// </summary>
/// <param name="stream">The stream to open.</param>
public TagCache(Stream stream)
{
Tags = new TagList(_tags);
if (stream.Length != 0)
Load(new BinaryReader(stream));
}
示例10: PutItemWithTagTask
public PutItemWithTagTask(TagList tags, Zone zone)
{
Name = "Put Item with tag: " + tags + " in zone " + zone.ID;
Tags = tags;
Zone = zone;
Priority = PriorityType.Low;
}
示例11: Build
/////////////////////////////////////////////////////////////////////////////
#region code
//
// template is in Templates.cs
//
public Tuple<string, string> Build()
{
// ******
var tagList = new TagList { };
tagList.AddChild( new QuickTag( "h4" )
.SetValue( About ) );
// ******
var instance = Templates.MoneyFlowTemplate.CreateTemplateInstance();
foreach( var item in AccountSummaryData.Create() ) {
instance.AddBodyRow(
item.Col1.ToString( "dd MMM yyyy" ),
item.Col2.ToString( "n" ),
item.Col3.ToString( "n" ),
item.Col4.ToString( "n" ),
item.Col5.ToString( "n" ),
item.Col6.ToString( "n" ),
item.Col7.ToString( "n" )
);
}
// ******
tagList.AddChild( instance.CreateTable() );
return new Tuple<string, string>( Render( tagList ), nameof( TableWithTemplate1 ) );
}
示例12: TagFolder
public TagFolder(string name)
{
FolderName = name;
Subfolders = new List<TagFolder>();
allTags = new List<Tag>();
Tags = new TagList();
}
示例13: Build
/////////////////////////////////////////////////////////////////////////////
#region code
public Tuple<string, string> Build()
{
// ******
var tagList = new TagList { };
tagList.AddChild( new QuickTag( "h4" )
.SetValue( About )
);
// ******
var table = new Table( caption: "Checking Account", border: 0, id: "", attrAndStyles: "" );
tagList.AddChild( table );
// ******
foreach( var item in AccountSummaryData.Create() ) {
table.AddBodyRow(
item.Col1.ToString( "dd MMM yyyy" ),
item.Col2.ToString(),
item.Col3.ToString(),
item.Col4.ToString(),
item.Col5.ToString(),
item.Col6.ToString(),
item.Col7.ToString()
);
}
// ******
return new Tuple<string, string>( Render( tagList ), nameof( TableWithData ) );
}
示例14: SerializeTest
public static void SerializeTest()
{
var tagList = new TagList("foo bar qux");
var json = JsonConvert.SerializeObject(tagList);
Assert.AreEqual("[\"foo\",\"bar\",\"qux\"]", json);
}
示例15: GetSource
/////////////////////////////////////////////////////////////////////////////
TagList GetSource( string src, string callerName )
{
const string REGION = "#region code";
const string ENDREGION = "#endregion";
// ******
//var searchStr = $"{REGION} {callerName}";
var indexStart = src.IndexOf( REGION );
if( indexStart < 0 ) {
return new TagList( null, new QuickTag( "div" ).SetValue( $"unable to locate method {callerName}" ) );
}
var indexEnd = src.IndexOf( ENDREGION, indexStart );
var length = (indexEnd - indexStart) + ENDREGION.Length;
var code = src.Substring( indexStart, length ).Replace( "\t", " ");
var codeTag = new QuickTag( "code", null, "data-language = csharp" )
.SetValue( code );
var preTag = new QuickTag( "pre");
preTag.AppendChildren( codeTag );
var tagList = new TagList( null, preTag);
return tagList;
}