当前位置: 首页>>代码示例>>C#>>正文


C# EditText.SetError方法代码示例

本文整理汇总了C#中EditText.SetError方法的典型用法代码示例。如果您正苦于以下问题:C# EditText.SetError方法的具体用法?C# EditText.SetError怎么用?C# EditText.SetError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EditText的用法示例。


在下文中一共展示了EditText.SetError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsLoginFormValidate

		public bool IsLoginFormValidate(EditText email, EditText password, ref View focus) {
			var icon = email.Context.Resources.GetDrawable(Android.Resource.Drawable.StatNotifyError);
			var emailText = email.Text;
			var passwordText = password.Text;
			if (emailText == null || emailText == String.Empty) {
				email.SetError(requiredFieldErrorMessage, icon);
				focus = email;
				return false;
			}
			Regex emailRegex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
			if (!emailRegex.IsMatch(emailText)) {
				email.SetError(incorrectEmailErrorMessage, icon);
				focus = email;
				return false;
			}
			else if (passwordText == null || passwordText == String.Empty) {
				password.SetError(requiredFieldErrorMessage, icon);
				focus = password;
				return false;
			}
			Regex passwordRegex = new Regex(@"\d+");
			if (passwordText.Length < 6 || (passwordText.Length > 6 && !passwordRegex.IsMatch(passwordText))) {
				password.SetError(incorrectPasswordErrorMessage, icon);
				focus = password;
				return false;
			}

			return true;
		}
开发者ID:MarcinSzyszka,项目名称:MobileSecondHand,代码行数:29,代码来源:FormValidator.cs

示例2: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.AddGroupMember, container, false);

            Button add_member = view.FindViewById<Button>(Resource.Id.add_member_btn);
            pseudo_membre = view.FindViewById<EditText>(Resource.Id.member_pseudo_editText);

            //action ajouter membre
            add_member.Click += delegate 
            {
                var isMySelf = false;
                if(pseudo_membre.Text == DataBase.current_user.pseudo)
                {
                    isMySelf = true;
                }
                var isUserContact = false;
                //on parcourt la liste des contacts du current_user et on regarde si celui qu'on ajoute en fait partie
                foreach(User user in DataBase.current_user.contacts)
                {
                    if(pseudo_membre.Text == user.pseudo)
                    {
                        isUserContact = true;
                        //on parcourt tous les grp du current_user et on se place dans celui qu'on a sélectionné
                        foreach(Group grp in DataBase.current_user.groups)
                        {
                            if(grp.groupName == GroupActivity.current_group.groupName)
                            {
                                //on vérifie que le contact qu'on ajoute n'est pas déjà membre du grp
                                var isAlreadyMember = false;
                                foreach(User us in grp.members)
                                {
                                    if (pseudo_membre.Text == us.pseudo)
                                    {
                                        isAlreadyMember = true;
                                        pseudo_membre.SetError("Cet utilisateur fais déjà partie du groupe !", null);
                                    }
                                }
                                if (!isAlreadyMember && !isMySelf)
                                {
                                    grp.addMember(user);
                                    user.addGroup(grp);
                                    Activity.StartActivity(typeof(GroupActivity));
                                }                                  
                            }
                        }
                    }
                }
                if(isMySelf)
                    pseudo_membre.SetError("Vous êtes déjà membre du groupe !", null);
                else if (!isUserContact)
                    pseudo_membre.SetError("Cet utilisateur ne fait pas partie de vos contacts !", null);
            };

            return view;
        }
开发者ID:souadbdi,项目名称:TeamEventApp,代码行数:57,代码来源:GroupAddMemberFragment.cs

示例3: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.Login);

			
			editLogin = (EditText)FindViewById (Resource.Id.editLogin);
			editPassword = (EditText)FindViewById (Resource.Id.editPassword);
			btnSignIn = (Button)FindViewById (Resource.Id.btnSignIn);
			btnSignIn.Click += async (sender, e) => {

				Drawable errorIcon = Resources.GetDrawable(Resource.Drawable.error); 
				errorIcon.SetBounds(0,0,errorIcon.IntrinsicWidth,errorIcon.IntrinsicHeight);
				bool trouve = false;
				bool empty = false;
				if (editLogin.Text.Length <= 0 || editPassword.Text.Length <= 0) {
					editLogin.SetError ("Login required!", errorIcon);
					if (editPassword.Text.Length <= 0) {
						editPassword.SetError ("Password required!", errorIcon);
					}
					empty = true;
				} else {
					/*int nbAccounts = accounts.Count ();
				string testLogin;
				string testPassword;

				int i = 0;
				while (i< nbAccounts && ! trouve) {
					testLogin = loginPrefs.GetString ("login_" + i, null);
					testPassword = loginPrefs.GetString ("password_" + i, null);
					if (editLogin.Text.ToString () == testLogin && editPassword.Text.ToString () == testPassword) {
						loginIntent = new Intent (this, typeof(MainActivity));
						loginIntent.PutExtra ("id",editPassword.Text.ToString () );
						StartActivity (loginIntent);
						trouve = true;
					} else {
						i++;
					}

 
				}*/

					string url = "http://192.168.1.12:8383/IBeaconService/rest/ClientServiceWS/authenticateUser?login="+
						editLogin.Text+"&password="+editPassword.Text;

					// Fetch the weather information asynchronously, 
					// parse the results, then update the screen:
					JsonValue json = await FetchUserAsync(url);

					ParseAndProcess(json);

				}
			};
			// Create your application here
		}
开发者ID:slitaiem,项目名称:great-subversion,代码行数:55,代码来源:LoginActivity.cs

示例4: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.EditProfil, container, false);

            //instanciation des edit text
            prenom = view.FindViewById<EditText>(Resource.Id.edit_fname_text);
            nom = view.FindViewById<EditText>(Resource.Id.edit_lname_text);
            pseudo = view.FindViewById<EditText>(Resource.Id.edit_pseudo_text);
            adr = view.FindViewById<EditText>(Resource.Id.edit_adress_text);
            mdp = view.FindViewById<EditText>(Resource.Id.edit_pwd_text);
            mdp2 = view.FindViewById<EditText>(Resource.Id.edit_confPwd_text);

            //action édition
            edit = view.FindViewById<Button>(Resource.Id.edit_btn);
            edit.Click += delegate
            {
                if (verifText(prenom))
                    DataBase.current_user.firstName = prenom.Text;
                if (verifText(nom))
                    DataBase.current_user.lastName = nom.Text;
                if (verifText(pseudo))
                    DataBase.current_user.pseudo = pseudo.Text;
                if (verifText(adr))
                    DataBase.current_user.localisation = adr.Text;
                if (verifText(mdp) && verifText(mdp2))
                {
                    if (mdp.Text != mdp2.Text)
                    {
                        mdp2.SetError("Les mots de passe ne correspondent pas", null);
                    }
                    else
                        DataBase.current_user.password = mdp.Text;
                }
                Activity.StartActivity(typeof(ProfileActivity));
            };

            // Return
            return view;
        }
开发者ID:souadbdi,项目名称:TeamEventApp,代码行数:41,代码来源:ProfilEditProfileFragment.cs

示例5: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.LoginActivitys);

            ColorDrawable colorDrawable = new ColorDrawable (Color.ParseColor (Helpers.ColorHeader));
            ActionBar.SetBackgroundDrawable (colorDrawable);

            BtnFacebook = FindViewById<Button> (Resource.Id.BtnFacebook);
            BtnRegister = FindViewById<Button> (Resource.Id.BtnRegister);
            BtnLogin = FindViewById<Button> (Resource.Id.BtnLogin);

            TxtLogin = FindViewById<EditText> (Resource.Id.TxtLogin);
            TxtPwd = FindViewById<EditText> (Resource.Id.TxtPwd);
            BtnFacebook.Visibility = ViewStates.Gone;

            #if DEBUG

            TxtLogin.Text="[email protected]";
            TxtPwd.Text="123456";

            #endif

            BtnRegister.Click += (sender, e) => {

                var datosActivity = new Intent (this, typeof(RegisterActivity));
                StartActivity (datosActivity);

            };

            BtnFacebook.Click += (sender, e) => {
                var webAuth = new Intent (this, typeof(FBWebViewAuthActivity));
                webAuth.PutExtra ("AppId", AppId);
                webAuth.PutExtra ("ExtendedPermissions", ExtendedPermissions);
                StartActivityForResult (webAuth, 0);
            };

            BtnLogin.Click += async (sender, e) => {

                if (TxtLogin.Text == string.Empty) {
                    TxtLogin.SetError ("Digite su Email", null);
                    TxtLogin.RequestFocus ();
                    return;
                }

                if (TxtPwd.Text == string.Empty) {
                    TxtPwd.SetError ("Digite su Contraseña", null);
                    TxtPwd.RequestFocus ();
                    return;
                }

                _ProgressDialog = ProgressDialog.Show (this, "Por favor espera...", "Procesando info...", true);

                ResultMsg<Users> user=	await _Bussines.Login (TxtLogin.Text, TxtPwd.Text);

                _ProgressDialog.Dismiss();

                if(user!=null && user.Dato!=null){

                    this.SetUserDatos(user.Dato);
                    var datosActivity = new Intent (this, typeof(GridActivity));
                    StartActivity (datosActivity);
                    Finish();

                }else{

                    Toast.MakeText (ApplicationContext, "Error: Su Usuario o Contraseña es erradas", ToastLength.Long).Show ();
                }

            };

            try {
                Account[] accounts = AccountManager.Get (this).GetAccountsByType ("com.google");

                foreach (Account account in accounts) {

                    if (!string.IsNullOrEmpty (account.Name)) {
                        TxtLogin.Text = account.Name;
                        return;
                    }

                    //accountsList.add(item);
                }
            } catch (Exception) {
                return;
            }
        }
开发者ID:jhondiaz,项目名称:Viewwin,代码行数:87,代码来源:LoginActivity.cs

示例6: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.AddGroupAdmin, container, false);

            Button add_admin = view.FindViewById<Button>(Resource.Id.add_admin_btn);
            pseudo_admin = view.FindViewById<EditText>(Resource.Id.admin_pseudo_editText);

            //action ajoiter admin
            add_admin.Click += delegate
            {
                var isMySelf = false;
                if (pseudo_admin.Text == DataBase.current_user.pseudo)
                {
                    isMySelf = true;
                }
                //on vérifie que l'utilisateur qu'on ajoute est dans current_user.conatcts
                var isUserContact = false;
                foreach (User user in DataBase.current_user.contacts)
                {
                    if (pseudo_admin.Text == user.pseudo)
                    {
                        isUserContact= true;
                        //on se place dans le groupe selectionné
                        foreach (Group grp in DataBase.current_user.groups)
                        {
                            if (grp.groupName == GroupActivity.current_group.groupName)
                            {
                                //on vérifie qu'il ne fait pas déjà partie des admins
                                var isAlreadyAdmin = false;
                                foreach(User ad in grp.admins)
                                {
                                    if (pseudo_admin.Text == ad.pseudo)
                                        isAlreadyAdmin = true;
                                }
                                if(isAlreadyAdmin)
                                    pseudo_admin.SetError("Cet utilisateur est déjà administrateur du groupe", null);

                                //on vérifie qu'il ne fait pas déjà partie des membres
                                var isAlreadyMember = false;
                                foreach (User ad in grp.members)
                                {
                                    if (pseudo_admin.Text == ad.pseudo)
                                        isAlreadyMember = true;
                                }

                                if(!isAlreadyAdmin && !isMySelf)
                                {
                                    grp.addAdmin(user);
                                    if (!isAlreadyMember)
                                    {
                                        grp.addMember(user);
                                        user.addGroup(grp);
                                    }
                                    Activity.StartActivity(typeof(GroupActivity));
                                }

                            }
                        }
                    }
                }
                if(isMySelf)
                    pseudo_admin.SetError("Vous êtes déja administrateur du groupe !", null);
                else if (!isUserContact)
                    pseudo_admin.SetError("Cet utilisateur ne fait pas partie de vos contacts !", null);
            };

            return view;
        }
开发者ID:souadbdi,项目名称:TeamEventApp,代码行数:70,代码来源:GroupAddAdminFragment.cs

示例7: verifText

 // fonction de verification des informations
  public bool verifText(string name, EditText edittext)
  {
      if(edittext.Text.ToString() == "")
     {
         edittext.SetError("Vous n'avez pas entré votre " + name, null);
         return true;
      }
      return false;
      
  }
开发者ID:hesrondev,项目名称:TeamEventApp,代码行数:11,代码来源:RegisterAccountActivity.cs


注:本文中的EditText.SetError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。