public override void ViewDidLoad() { base.ViewDidLoad(); if (NavigationController != null) { NavigationController.NavigationBarHidden = true; } Waiting.Color = UIColor.Yellow; Bindings.Bind(Waiting).For(x => x.Hidden).To(x => x.InFlight); Bindings.Apply(); ViewModel.AuthenticateEvent += (object sender, SdkEventArgs e) => { if (!e.Successful) { this.Alert("Error", "cannot contact server, please check your internet connection"); } }; Task.Delay(1000); ViewModel.AuthenticateCommand.Execute(); }
private void OnEntityModified(EntityModified e) { Bindings.Apply(e.Entity); SaveGameBindings(); //SaveToAzureTableStorage(e.Entity); }
public override void ViewDidLoad() { base.ViewDidLoad(); UIApplication.SharedApplication.StatusBarHidden = false; UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent; if (NavigationController != null) { this.NavigationController.NavigationBar.Hidden = true; } screenTap = new UITapGestureRecognizer(() => { txtEmail.ResignFirstResponder(); txtPassword.ResignFirstResponder(); }); FormContainer.AddGestureRecognizer(screenTap); Bindings.Bind(txtEmail).For(x => x.Text).To(vm => vm.Email); Bindings.Bind(txtPassword).For(x => x.Text).To(vm => vm.Password); Bindings.Bind(btnLogin).To(vm => vm.SignInCommand); Bindings.Bind(Waiting).For(x => x.Hidden).To(vm => vm.InFlight).WithConversion(new InverseConverter()); Bindings.Bind(logoImage).To(vm => vm.PorpoiseLogo).WithConversion("InMemoryImage"); Bindings.Apply(); //Set Porpoise Logo Image ViewModel.ForPropertyChange(x => x.PorpoiseLogo, y => { //Debug.WriteLine("PORPOISE LOGO CHANGED"); //logoImage.Image = PorpoiseImage.getFromByteArray(y); }); //Set envelope Image ViewModel.ForPropertyChange(x => x.EnvelopeIcon, y => { //Debug.WriteLine("PORPOISE LOGO CHANGED"); envelopeImage = PorpoiseImage.getFromByteArray(y); }); //Set envelope Image ViewModel.ForPropertyChange(x => x.KeyIcon, y => { //Debug.WriteLine("PORPOISE LOGO CHANGED"); passwordIcon = PorpoiseImage.getFromByteArray(y); }); ViewModel.SignInEvent += (sender, e) => { if (!e.Successful) { this.Alert(UIAlertActionStyle.Default, Resources.ProblemOccurred, e.Message, null, btnLogin); } }; txtEmail.RightView = MakeInputErrorInfo(() => Resources.InvalidEmail); txtEmail.RightView.TintColor = PorpoiseColors.LightErrorRed; txtPassword.RightView = MakeInputErrorInfo(() => Resources.InvalidPassword); txtPassword.RightView.TintColor = PorpoiseColors.LightErrorRed; txtEmail.ReturnKeyType = UIReturnKeyType.Done; txtEmail.ShouldReturn = field => { txtPassword.BecomeFirstResponder(); return(true); }; txtEmail.EditingDidEnd += (sender, e) => { txtEmail.RightViewMode = ViewModel.EmailValid ? UITextFieldViewMode.Never : UITextFieldViewMode.UnlessEditing; //txtEmail.ColoredBorder(ViewModel.EmailValid ? PorpoiseColors.Grey.CGColor : PorpoiseColors.Grey.CGColor); }; txtPassword.EnablesReturnKeyAutomatically = true; txtPassword.ShouldReturn = field => { field.ResignFirstResponder(); ViewModel.SignInCommand.Execute(); return(true); }; txtPassword.ReturnKeyType = UIReturnKeyType.Done; txtPassword.EditingDidEnd += (sender, e) => { txtPassword.RightViewMode = ViewModel.PasswordValid ? UITextFieldViewMode.Never : UITextFieldViewMode.UnlessEditing; //txtPassword.ColoredBorder(ViewModel.PasswordValid ? PorpoiseColors.Grey.CGColor : PorpoiseColors.Grey.CGColor); this.btnLogin.BecomeFirstResponder(); }; StyleFormElements(); //ClickHereTextView.DataDetectorTypes = UIDataDetectorType.Link; SetUpRegisterUrl(); //ClickHereTextView.AddGestureRecognizer(tapGestureRecognizer); //ForgotPwText.DataDetectorTypes = UIDataDetectorType.Link; SetupForgotPwUrl(); this.NavigationController.InteractivePopGestureRecognizer.Enabled = false; }