Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DefaultPage.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
4using Waher.Things;
7
9{
14 {
18 public DefaultPage()
19 : base(null, null)
20 {
21 this.Host = string.Empty;
22 this.Page = string.Empty;
23 }
24
33 : base(Source, Parent)
34 {
35 this.Host = Host;
36 this.Page = Page;
37 }
38
42 [Page(7, "Configuration")]
43 [Header(8, "Host name:")]
44 [ToolTip(9, "Default page will be valid for pages accessed via this host name.")]
45 public string Host { get; set; }
46
50 [Page(7, "Configuration")]
51 [Header(10, "Page:")]
52 [ToolTip(11, "Local page name that the user will be redirected to, if accessing the host name without specifying a local resource.")]
53 [Required]
54 [Text(TextPosition.AfterField, 63, "Note: Changes will take effect after broker has been restarted.")]
55 public string Page { get; set; }
56
60 public override string NodeId => string.IsNullOrEmpty(this.Host) ? "(Default)" : this.Host;
61
66 public override Task<string> GetTypeNameAsync(Language Language) => Language.GetStringAsync(typeof(GatewayConfigSource), 3, "Default Page");
67
73 public override Task<bool> AcceptsParentAsync(INode Parent)
74 {
75 return Task.FromResult(Parent is WebServer);
76 }
77
84 public override async Task<IEnumerable<Parameter>> GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
85 {
86 LinkedList<Parameter> Parameters = new LinkedList<Parameter>();
88
89 Parameters.AddLast(new StringParameter("Location", await Namespace.GetStringAsync(82, "Location"), this.Page));
90
91 return Parameters;
92 }
93 }
94}
Contains information about a language.
Definition: Language.cs:17
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Definition: Language.cs:209
async Task< Namespace > GetNamespaceAsync(string Name)
Gets the namespace object, given its name, if available.
Definition: Language.cs:99
Contains information about a namespace in a language.
Definition: Namespace.cs:17
Task< LanguageString > GetStringAsync(int Id)
Gets the string object, given its ID, if available.
Definition: Namespace.cs:65
Abstract base class for gateway configuration nodes.
virtual INode Parent
Parent Node, or null if a root node.
GatewayConfigSource Source
Source hosting the node.
DefaultPage(GatewayConfigSource Source, WebServer Parent, string Host, string Page)
Defines a default page for a host.
Definition: DefaultPage.cs:32
override Task< bool > AcceptsParentAsync(INode Parent)
If the node accepts a presumptive parent, i.e. can be added to that parent (if that parent accepts th...
Definition: DefaultPage.cs:73
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
override async Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
Definition: DefaultPage.cs:84
DefaultPage()
Defines a default page for a host.
Definition: DefaultPage.cs:18
Tokens available in request.
Definition: RequestOrigin.cs:9
Interface for nodes that are published through the concentrator interface.
Definition: INode.cs:49
TextPosition
Where the instructions are to be place.
Definition: TextAttribute.cs:9