コード例 #1
0
        public CreateProfilePage()
        {
            InitializeComponent();

            this.WhenViewModelActivated(d =>
            {
                MemoryLeaksHunter.TrackActivation(this, d);

                this.Bind(ViewModel, vm => vm.Name, view => view.nameEntry.Text).DisposeWith(d);
                this.Bind(ViewModel, vm => vm.Email, view => view.emailEntry.Text).DisposeWith(d);
                this.Bind(ViewModel, vm => vm.Password, view => view.passwordEntry.Text).DisposeWith(d);

                this.BindCommand(ViewModel, vm => vm.CreateCommand, view => view.createBtn)
                .ControlButtonEnabledWhenDisposed(ViewModel.CreateCommand, createBtn)
                .DisposeWith(d);
                this.BindCommand(ViewModel, vm => vm.LoginCommand, view => view.loginTgr).DisposeWith(d);

                this.Bind(ViewModel, vm => vm.UserTermsAgreed, view => view.userTermsCheckBox.IsChecked).DisposeWith(d);
                this.BindCommand(ViewModel, vm => vm.ShowUserTermsCommand, view => view.showUserTermsTgr).DisposeWith(d);

                this.Bind(ViewModel, vm => vm.PrivacyPolicyAgreed, view => view.privacyPolicyCheckBox.IsChecked).DisposeWith(d);
                this.BindCommand(ViewModel, vm => vm.ShowPrivacyPolicyCommand, view => view.showPrivacyPolicyTgr).DisposeWith(d);

                ViewModel.CreateCommand.IsExecuting.BindTo(spinner, s => s.IsSpinning).DisposeWith(d);

                this.Bind(ViewModel, vm => vm.Error, view => view.errorLabel.Text).DisposeWith(d);
            });
        }
コード例 #2
0
        public WebPage()
        {
            InitializeComponent();

            this.WhenViewModelActivated(d =>
            {
                MemoryLeaksHunter.TrackActivation(this, d);

                this.BindCommand(ViewModel, vm => vm.NavigateBack, view => view.backBtn).DisposeWith(d);

                webView.Source = new UrlWebViewSource {
                    Url = ViewModel.Url
                };

                webView.Events().Navigating.Skip(1).Subscribe(args => args.Cancel = true).DisposeWith(d);
            });
        }
コード例 #3
0
        public LoginPage()
        {
            InitializeComponent();

            this.WhenViewModelActivated(d =>
            {
                MemoryLeaksHunter.TrackActivation(this, d);

                this.Bind(ViewModel, vm => vm.Email, view => view.emailEntry.Text).DisposeWith(d);
                this.Bind(ViewModel, vm => vm.Password, view => view.passwordEntry.Text).DisposeWith(d);
                this.OneWayBind(ViewModel, vm => vm.Description, view => view.descriptionLabel.Text).DisposeWith(d);

                this.BindCommand(ViewModel, vm => vm.LoginCommand, view => view.loginBtn).DisposeWith(d);
                this.BindCommand(ViewModel, vm => vm.RecoverPasswordCommand, view => view.recoverPasswordTgr).DisposeWith(d);
                this.BindCommand(ViewModel, vm => vm.CreateCommand, view => view.createTgr).DisposeWith(d);

                ViewModel.LoginCommand.IsExecuting.BindTo(spinner, s => s.IsSpinning).DisposeWith(d);

                this.Bind(ViewModel, vm => vm.Error, view => view.errorLabel.Text).DisposeWith(d);
            });
        }