protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.CustomTitle); // Create your application here SetContentView(Resource.Layout.RegisterResultLayout); Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout.custom_title_bar); sp_userinfo = this.GetSharedPreferences(Global.SHAREDPREFERENCES_USERINFO, FileCreationMode.Private); _jpushUtil = new JPushUtil(this); InitView(); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); RequestWindowFeature (WindowFeatures.CustomTitle); // Create your application here SetContentView(Resource.Layout.RegisterResultLayout); Window.SetFeatureInt (WindowFeatures.CustomTitle, Resource.Layout.custom_title_bar); sp_userinfo = this.GetSharedPreferences(Global.SHAREDPREFERENCES_USERINFO,FileCreationMode.Private); _jpushUtil = new JPushUtil (this); InitView (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.LoginLayout); _jpushUtil = new JPushUtil(this); // Create your application here //或得共享实例变量 sp_userinfo = this.GetSharedPreferences(Global.SHAREDPREFERENCES_USERINFO, FileCreationMode.Private); //获得实例对象 edit_userName = FindViewById <EditText>(Resource.Id.edit_UserName); edit_userPassword = FindViewById <EditText> (Resource.Id.edit_PassWord); cb_passWord = FindViewById <CheckBox> (Resource.Id.cb_Password); //cb_autoLogin = FindViewById<CheckBox> (Resource.Id.cb_AutoLogin); btn_login = FindViewById <Button> (Resource.Id.btn_Login); tv_Register = FindViewById <TextView> (Resource.Id.tv_Register); var tv_forgetPwd = FindViewById <TextView> (Resource.Id.tv_forgetPwd); var img_eye = FindViewById <ImageView> (Resource.Id.img_eye); img_eye.Click += (sender, e) => { if (edit_userPassword.InputType == (Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationPassword)) { edit_userPassword.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationVisiblePassword; img_eye.SetImageResource(Resource.Drawable.ic_login_eye_selected); } else if (edit_userPassword.InputType == (Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationVisiblePassword)) { edit_userPassword.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationPassword; img_eye.SetImageResource(Resource.Drawable.ic_login_eye_normal); } }; //点击注册 tv_Register.Click += (sender, e) => { StartActivity(typeof(RegisterActivity)); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; //找回密码 tv_forgetPwd.Click += (sender, e) => { var intent = new Intent(this, typeof(SendSecurityCodeActivity)); var sendbundle = new Bundle(); sendbundle.PutString("SendType", "FindPwd"); sendbundle.PutString("PhoneNumber", string.Empty); intent.PutExtras(sendbundle); StartActivity(intent); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; //如果选择了记住密码,则赋值 if (sp_userinfo.GetBoolean(Global.login_Password_Check, false)) { cb_passWord.Checked = true; edit_userName.Text = sp_userinfo.GetString(Global.login_UserName, string.Empty); edit_userPassword.Text = sp_userinfo.GetString(Global.login_Password, string.Empty); // if (sp_userinfo.GetBoolean (Global.login_AutoLogin_Check, false)) { // cb_autoLogin.Checked = true; // } } ///自动登录选择框事件 // cb_autoLogin.CheckedChange += (sender, e) => // { // if(cb_autoLogin.Checked) // sp_userinfo.Edit().PutBoolean(Global.login_AutoLogin_Check,true).Commit(); // else // sp_userinfo.Edit().PutBoolean(Global.login_AutoLogin_Check,false).Commit(); // }; //记住密码选择事件 cb_passWord.CheckedChange += (sender, e) => { if (cb_passWord.Checked) { sp_userinfo.Edit().PutBoolean(Global.login_Password_Check, true).Commit(); } else { sp_userinfo.Edit().PutBoolean(Global.login_Password_Check, false).Commit(); } }; //登录按钮事件 btn_login.Click += (sender, e) => { Login(); }; }