12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using Bridge.Html5;
- using FrontendRouting;
- using LearnBridgeNet.Views.Basic;
- namespace LearnBridgeNet.Views
- {
- [FeRoute("/logoff.html")]
- internal class LogoffView : AuthRequiredView
- {
- private readonly HTMLElement _root;
- public LogoffView()
- {
- _root = new HTMLDivElement();
- _root.AppendChild(new HTMLHeadingElement(HeadingType.H1)
- {
- TextContent = "Safe exit",
- });
- _root.AppendChild(new HTMLInputElement
- {
- Type = InputType.Button,
- Value = "Login again",
- OnClick = evt => FeRoutingManager.Go("/", true)
- });
- }
- public override bool BeforeEnter(FeRoutingView currentView)
- {
- if (null == currentView && false == XState.IsLogin)
- {
- FeRoutingManager.Go("/");
- return false;
- }
- if (currentView is LogonView)
- {
- FeRoutingManager.Go("/", true);
- return false;
- }
- return base.BeforeEnter(currentView);
- }
- public override void Enter(Node parent)
- {
- App.NavigateBar.Hidden = true;
- XState.IsLogin = false;
- parent.AppendChild(_root);
- }
- public override void Leave()
- {
- _root.Remove();
- App.NavigateBar.Hidden = true;
- }
- }
- }
|