Exemplo n.º 1
0
        public override Task Prepare(HttpContext context)
        {
            Title = "Ops";
            CssUrls.Add("/.Face.css");
            JsUrls.Add("/.Face.js");

            PartList parts = new PartList {
                new HeadingElement(1)
                {
                    Content = new PlainText("Ops")
                },
                new PlainText("Here's an image"),
                new BreakElement(),
                new ImageElement()
                {
                    Classes   = new[] { "crabs" },
                    SourceUrl = "https://www.citarella.com/media/catalog/product/cache/1/image/97a78116f02a369697db694bbb2dfa59/0/2/024029200000_01_1.jpg"
                },
                ":D"
            };

            parts.Add(":D");

            Body.Append(new StandardBody {
                Content    = parts,
                ActiveHRef = "/ops"
            });
            return(Task.CompletedTask);
        }
Exemplo n.º 2
0
        public override Task Prepare(HttpContext context)
        {
            Title = "ERROR | Face";
            Body.Classes.Add("errorPage");
            CssUrls.Add("/.Face.css");
            JsUrls.Add("/.Face.js");

            PartList parts = new PartList {
                new DivElement()
                {
                    Classes = new[] { "panel" },
                    Content = new Part[] {
                        new HeadingElement(1)
                        {
                            Content = new[] { new PlainText("ERROR") },
                        },
                        new SectionElement()
                        {
                            Content = new Part[] {
                                new LabelElement()
                                {
                                    Content = new PlainText("0x" + _errorCode.ToString("X")),
                                },
                                new PlainText(getStatusDescription(_errorCode))
                            },
                        },
                    }
                }
            };

            Body.Append(new StandardBody {
                Content = parts,
            });
            return(Task.CompletedTask);
        }
Exemplo n.º 3
0
    public override Task Prepare(HttpContext context)
    {
        Title = "Central";
        Body.Classes.Add("homepage");
        CssUrls.Add("/.Face.css");
        JsUrls.Add("/.Face.js");

        PartList parts           = new PartList();
        var      uptime          = Convert.ToInt64(Environment.TickCount64);
        var      currentTime     = Convert.ToInt64(new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds());
        var      powerOnUnixTime = Convert.ToInt64(Math.Round(Convert.ToDouble(currentTime - uptime)) / 1000);

        parts.Add(new DivElement {
            Classes = new[] { "panel" },
            Content = new Part[] {
                new HeadingElement(1)
                {
                    Content = "Information",
                },
                new SectionElement {
                    Content = new Part[] {
                        new LabelElement()
                        {
                            Content = new PlainText("Device"),
                        },
                        Environment.MachineName
                    },
                },
                new SectionElement {
                    Content = new Part[] {
                        new LabelElement()
                        {
                            Content = new PlainText("Uptime"),
                        },
                        new TimeAgo(powerOnUnixTime)
                    },
                },
                new SectionElement {
                    Content = new Part[] {
                        new LabelElement()
                        {
                            Content = new PlainText("Generated"),
                        },
                        new TimeAgo(currentTime / 1000),
                        new PlainText(" ago"),
                    },
                },
            }
        });

        parts.Add(new DivElement {
            Classes = new[] { "panel" },
            Content = new Part[] {
                new HeadingElement(1)
                {
                    Content = new PlainText("Event Log"),
                },
                new EventLog()
                {
                    Classes = "eventLog",
                    Content = new [] {
                        new EventListItem {
                            Label   = "KNotify",
                            Content = new RawHtml("<b>Download complete:</b> Ainsley Harriot's Ultimate Reddy-Brek Recipies.pdf"),
                        },
                        new EventListItem {
                            Label   = "Authorised",
                            Classes = new[] { "good" },
                            Content = new RawHtml("Your request for <em>skynet5 repository access</em> was accepted"),
                        },
                        new EventListItem {
                            Label   = "Message",
                            Content = new RawHtml("Received a <a href='converse/rickyg'>message</a> from <em>Ricky G</em>"),
                        },
                        new EventListItem {
                            Label   = "Project Y",
                            Classes = new [] { "projectY" },
                            Content = new PlainText("The rabbit is in the hutch"),
                        },
                        new EventListItem {
                            Label   = "Incoming call",
                            Classes = new[] { "priority" },
                            Content = new Part[] {
                                new RawHtml("<em>Johnny Ten</em>, unscheduled<br>"),
                                new DelegateButton {
                                    OnClick = (context, post) => {
                                        Console.WriteLine("Connecting call");
                                        return(Task.CompletedTask);
                                    },
                                    Once = true,
                                    TimeToLiveSeconds = 90,                                     // 0 = until ping timeout
                                    Content           = new PlainText("Answer")
                                },
                            }
                        },
                    },
                },
            }
        });


        Body.Append(new StandardBody {
            Content    = parts,
            ActiveHRef = "/"
        });
        return(Task.CompletedTask);
    }