コード例 #1
0
        public string Validate(string propertyName)
        {
            string result = string.Empty;

            switch (propertyName)
            {
            case nameof(PlaceName):
                if (string.IsNullOrWhiteSpace(PlaceName) || !PlaceName.ValidateFileName())
                {
                    result = "Invalid filename.";
                }
                else if (File.Exists(GetPath()))
                {
                    result = "A place with that name already exists.";
                }
                break;
            }
            return(result);
        }