HomeView.cs 883 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using Bridge.Html5;
  2. using FrontendRouting;
  3. using LearnBridgeNet.Views.Basic;
  4. namespace LearnBridgeNet.Views
  5. {
  6. [FeRoute("/")]
  7. internal class HomeView : AuthRequiredView
  8. {
  9. private readonly HTMLElement _root;
  10. public HomeView()
  11. {
  12. _root = new HTMLDivElement();
  13. _root.AppendChild(new HTMLHeadingElement(HeadingType.H1)
  14. {
  15. TextContent = "Home Page",
  16. });
  17. _root.AppendChild(new HTMLInputElement
  18. {
  19. Type = InputType.Button,
  20. Value = "Demo",
  21. OnClick = evt => FeRoutingManager.Go("/demo.html")
  22. });
  23. }
  24. public override void Enter(Node parent)
  25. {
  26. parent.AppendChild(_root);
  27. }
  28. public override void Leave()
  29. {
  30. _root.Remove();
  31. }
  32. }
  33. }