FlorianDahn de4cc138ae - New control: CalendarPicker
- New control: MonthPicker
- New control TreeView
- adding examples for all 3
- small change on Progress Bar Control
- due latest changes on the base it is now easier to create controls which will be rendered (or not)in several forms depending on user context
2019-07-14 22:27:16 +02:00

66 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TelegramBotBase.Controls
{
public class TreeViewNode
{
public String Text { get; set; }
public String Value { get; set; }
public String Url { get; set; }
public List<TreeViewNode> ChildNodes { get; set; } = new List<TreeViewNode>();
public TreeViewNode ParentNode { get; set; }
public TreeViewNode(String Text, String Value)
{
this.Text = Text;
this.Value = Value;
}
public TreeViewNode(String Text, String Value, String Url) : this(Text, Value)
{
this.Url = Url;
}
public TreeViewNode(String Text, String Value, params TreeViewNode[] childnodes) : this(Text, Value)
{
foreach(var c in childnodes)
{
AddNode(c);
}
}
public void AddNode(TreeViewNode node)
{
node.ParentNode = this;
ChildNodes.Add(node);
}
public TreeViewNode FindNodeByValue(String Value)
{
return this.ChildNodes.FirstOrDefault(a => a.Value == Value);
}
public String GetPath()
{
String s = "\\" + this.Value;
var p = this;
while (p.ParentNode != null)
{
s = "\\" + p.ParentNode.Value + s;
p = p.ParentNode;
}
return s;
}
}
}