public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            App.Create();

            LoginBackgroundView.Layer.CornerRadius = 5;

            AuthenticatingBinding = this.SetBinding(() => VM.Authenticating);
            AuthenticatingBinding.WhenSourceChanges(() => BlurVisualEffect.Hidden = !VM.Authenticating);

            ProblemsButtonBinding = this.SetBinding(() => VM.ProblemsButtonVisibility);
            ProblemsButtonBinding.WhenSourceChanges(() => ProblemsButton.Hidden = !VM.ProblemsButtonVisibility);

            CurrentApiTypeBinding = this.SetBinding(() => VM.CurrentApiType);
            CurrentApiTypeBinding.WhenSourceChanges(() =>
            {
                switch (VM.CurrentApiType)
                {
                case ApiType.Hummingbird:
                    HummigbirdButton.BackgroundColor  = UIColor.FromRGBA(10, 115, 255, 60);
                    MyAnimeListButton.BackgroundColor = UIColor.FromRGBA(10, 115, 255, 30);
                    break;

                case ApiType.Mal:
                    MyAnimeListButton.BackgroundColor = UIColor.FromRGBA(10, 115, 255, 60);
                    HummigbirdButton.BackgroundColor  = UIColor.FromRGBA(10, 115, 255, 30);
                    break;
                }
            });

            LogInLogOutBinding = this.SetBinding(() => VM.LogOutButtonVisibility);
            LogInLogOutBinding.WhenSourceChanges(() =>
            {
                LogInButton.Hidden  = VM.LogOutButtonVisibility;
                LogOutButton.Hidden = !VM.LogOutButtonVisibility;
            });

            HummigbirdButton.SetCommand("TouchUpInside", VM.FocusHumCommand);
            MyAnimeListButton.SetCommand("TouchUpInside", VM.FocusMalCommand);
            ProblemsButton.SetCommand("TouchUpInside", VM.ProblemsCommand);
            RegisterButton.SetCommand("TouchUpInside", VM.NavigateRegister);

            UsernameTextField.ShouldReturn += UsernameTextField_ShouldReturn;
            PasswordTextField.ShouldReturn += UsernameTextField_ShouldReturn;
        }
Esempio n. 2
0
        void ReleaseDesignerOutlets()
        {
            if (BlurVisualEffect != null)
            {
                BlurVisualEffect.Dispose();
                BlurVisualEffect = null;
            }

            if (HummigbirdButton != null)
            {
                HummigbirdButton.Dispose();
                HummigbirdButton = null;
            }

            if (LoginBackgroundView != null)
            {
                LoginBackgroundView.Dispose();
                LoginBackgroundView = null;
            }

            if (LogInButton != null)
            {
                LogInButton.Dispose();
                LogInButton = null;
            }

            if (LogOutButton != null)
            {
                LogOutButton.Dispose();
                LogOutButton = null;
            }

            if (MyAnimeListButton != null)
            {
                MyAnimeListButton.Dispose();
                MyAnimeListButton = null;
            }

            if (PasswordTextField != null)
            {
                PasswordTextField.Dispose();
                PasswordTextField = null;
            }

            if (ProblemsButton != null)
            {
                ProblemsButton.Dispose();
                ProblemsButton = null;
            }

            if (RegisterButton != null)
            {
                RegisterButton.Dispose();
                RegisterButton = null;
            }

            if (UsernameTextField != null)
            {
                UsernameTextField.Dispose();
                UsernameTextField = null;
            }
        }