Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
McpDateParameterAttribute.cs
1using System;
4
6{
10 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue |
11 AttributeTargets.Property | AttributeTargets.Field,
12 Inherited = true, AllowMultiple = false)]
14 {
21 : base(Title, Description)
22 {
23 }
24
29 public override void Annotate(Dictionary<string, object?> Schema)
30 {
31 base.Annotate(Schema);
32
33 Schema["format"] = "date";
34 }
35
40 public override void GetHtmlInputAttributes(Dictionary<string, string> Attributes)
41 {
42 base.GetHtmlInputAttributes(Attributes);
43 Attributes["type"] = "date";
44 }
45
51 public override string GetHtmlAttributeValue(object Value)
52 {
53 if (Value is DateTime TP)
54 return XML.Encode(TP, true);
55 else
56 return base.GetHtmlAttributeValue(Value);
57 }
58 }
59}
Helps with common XML-related tasks.
Definition: XML.cs:21
static string Encode(string s)
Encodes a string for use in XML.
Definition: XML.cs:29
override string GetHtmlAttributeValue(object Value)
Gets the HTML attribute value for a parameter, if any.
override void Annotate(Dictionary< string, object?> Schema)
Annotates a schema object with information in the attribute.
override void GetHtmlInputAttributes(Dictionary< string, string > Attributes)
Gets HTML input attributes for the parameter, if any.
McpDateParameterAttribute(string? Title, string? Description)
Provides meta-data about a date-valued parameter.