コード例 #1
0
        private bool ValidateSave()
        {
            if (this.CurrentlySelectedFieldId == Guid.Empty)
            {
                return(true);
            }

            if (this.NameField.Text.Contains(" "))
            {
                Baloon(this.NameField, GetString("SpaceInNameError"));
                return(false);
            }

            if (string.IsNullOrEmpty(this.NameField.Text))
            {
                Baloon(this.NameField, GetString("NameEmptyError"));
                return(false);
            }

            if (this.CurrentFields.Any(f => f.Name == this.NameField.Text && f.Id != this.CurrentlySelectedFieldId))
            {
                Baloon(this.NameField, GetString("NameAlreadyInUseError"));
                return(false);
            }

            string toValidate = this.NameField.Text.StartsWith("@") ? this.NameField.Text.Substring(1) : this.NameField.Text;
            string err;

            if (!NameValidation.TryValidateName(toValidate, out err))
            {
                Baloon(this.NameField, err);
                return(false);
            }

            return(true);
        }
コード例 #2
0
        /// <exclude />
        public bool ValidateNewTypeName(string typeName, out string message)
        {
            Verify.ArgumentNotNullOrEmpty(typeName, "typeName");

            return(NameValidation.TryValidateName(typeName, out message));
        }