protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			RequestWindowFeature (WindowFeatures.CustomTitle);
			// Create your application here
			SetContentView(Resource.Layout.RegisterStepTwoLayout);
			Window.SetFeatureInt (WindowFeatures.CustomTitle, Resource.Layout.custom_title_bar);
			sp_userinfo = this.GetSharedPreferences(Global.SHAREDPREFERENCES_USERINFO,FileCreationMode.Private);
			_jpushUtil = new JPushUtil (this);
			InitView ();

		}
Пример #2
0
		private void InitView()
		{
			//设置标题栏
			var img_header_back = FindViewById<ImageView> (Resource.Id.img_header_back);
			img_header_back.Click += (sender, e) => 
			{
				this.Finish();
				OverridePendingTransition(Resource.Animation.bottom_out,0);
			};

			var tv_back = FindViewById<TextView> (Resource.Id.tv_back);
			tv_back.Text = "";
			var tv_desc = FindViewById<TextView> (Resource.Id.tv_desc);
			tv_desc.Text = "登录";



			_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);
			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(RegisterStepOneActivity));
				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.refrence_Password_Check, false)) {
				cb_passWord.Checked = true;
				edit_userName.Text = sp_userinfo.GetString (Global.refrence_UserName, string.Empty);
				edit_userPassword.Text = sp_userinfo.GetString (Global.refrence_Password, string.Empty);
			}



			//记住密码选择事件
			cb_passWord.CheckedChange += (sender, e) => 
			{
				if(cb_passWord.Checked)
					sp_userinfo.Edit().PutBoolean(Global.refrence_Password_Check,true).Commit();
				else
					sp_userinfo.Edit().PutBoolean(Global.refrence_Password_Check,false).Commit();
			};


			//登录按钮事件
			btn_login.Click += (sender, e) => 
			{

				Login();
			};
		}