public void Init(IQFrameworkContainer container) { new LabelView("账户信息").FontSize(12).AddTo(this); var boxLayout = new VerticalLayout("box").AddTo(this); var logoutBtn = new ButtonView("注销") .Do(btn => btn.Visible = PackageKitLoginState.Logined.Value) .AddTo(boxLayout); var loginView = new LoginView() .Do(self => self.Visible = PackageKitLoginState.LoginViewVisible.Value) .AddTo(boxLayout); var registerView = new RegisterView() .Do(self => self.Visible = PackageKitLoginState.RegisterViewVisible.Value) .AddTo(boxLayout); PackageKitLoginState.Logined.Bind(value => { logoutBtn.Visible = value; }).AddTo(mDisposableList); logoutBtn.OnClick.AddListener(() => { PackageKitLoginApp.Send <LogoutCommand>(); }); PackageKitLoginState.LoginViewVisible.Bind(value => { loginView.Visible = value; }).AddTo(mDisposableList); PackageKitLoginState.RegisterViewVisible.Bind(value => { registerView.Visible = value; }).AddTo(mDisposableList); }
public void Init(IQFrameworkContainer container) { var expendLayout = new TreeNode(false, LocaleText.UserInfo) .AddTo(this); var boxLayout = new VerticalLayout("box"); expendLayout.Add2Spread(boxLayout); var logoutBtn = new ButtonView("注销").AddTo(boxLayout); var loginView = new LoginView() .Do(self => self.Visible = PackageKitLoginState.LoginViewVisible.Value) .AddTo(boxLayout); var registerView = new RegisterView() .Do(self => self.Visible = PackageKitLoginState.RegisterViewVisible.Value) .AddTo(boxLayout); PackageKitLoginState.Logined.Bind(value => { logoutBtn.Visible = value; }).AddTo(mDisposableList); logoutBtn.OnClick.AddListener(() => { PackageKitLoginApp.Send <LogoutCommand>(); }); PackageKitLoginState.LoginViewVisible.Bind(value => { loginView.Visible = value; }).AddTo(mDisposableList); PackageKitLoginState.RegisterViewVisible.Bind(value => { registerView.Visible = value; }).AddTo(mDisposableList); }