Example #1
0
 protected override async void  OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.Main);
     StatusBarUtil.ColorStatusBar(this, Resources.GetColor(Resource.Color.color_primary));
     mAdapter = new MainFragmentPagerAdapter(SupportFragmentManager, this);
     bindViews();
 }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.LoginActivity);
            tv_goreg          = FindViewById <TextView>(Resource.Id.tv_goreg);
            accountContainer  = FindViewById <TextInputLayout>(Resource.Id.accountContainer);
            passWordContainer = FindViewById <TextInputLayout>(Resource.Id.passWordContainer);
            btnLogin          = FindViewById <Button>(Resource.Id.btn_login);
            StatusBarUtil.ColorStatusBar(this, Resources.GetColor(Resource.Color.color_primary));

            btnLogin.Enabled = false;
            btnLogin.Click  += btnLogin_Click;
            tv_goreg.Click  += (s, e) =>
            {
                Intent intent = new Intent(this, typeof(RegisterActivity));
                StartActivity(intent);
            };
            accountContainer.EditText.FocusChange += (s, e) =>
            {
                if (!e.HasFocus)
                {
                    if (!checkAccount(accountContainer.EditText.Text))
                    {
                        accountContainer.ErrorEnabled = true;
                        accountContainer.Error        = accountError;
                    }
                    else
                    {
                        accountContainer.ErrorEnabled = false;
                    }
                }
            };

            passWordContainer.EditText.FocusChange += (s, e) =>
            {
                if (!e.HasFocus)
                {
                    if (!checkPwd(passWordContainer.EditText.Text))
                    {
                        passWordContainer.ErrorEnabled = true;
                        passWordContainer.Error        = pwdError;
                    }
                    else
                    {
                        passWordContainer.ErrorEnabled = false;
                    }
                }
            };

            accountContainer.EditText.TextChanged += (s, e) =>
            {
                System.Diagnostics.Debug.WriteLine(e.Start);
                if (e.Start >= 3)
                {
                    if (accountContainer.ErrorEnabled == false && !checkAccount(e.Text.ToString()))
                    {
                        accountContainer.ErrorEnabled = true;
                        accountContainer.Error        = accountError;
                    }
                    else
                    {
                        accountContainer.ErrorEnabled = false;
                    }
                    checkBtnStatus();
                }
            };

            passWordContainer.EditText.TextChanged += (s, e) =>
            {
                if (e.Start >= 5)
                {
                    if (passWordContainer.ErrorEnabled == false && !checkPwd(e.Text.ToString()))
                    {
                        passWordContainer.ErrorEnabled = true;
                        passWordContainer.Error        = pwdError;
                    }
                    else
                    {
                        passWordContainer.ErrorEnabled = false;
                    }
                    checkBtnStatus();
                }
            };
            // Create your application here
        }