/// <summary>
        /// Delegate used to submit the element </summary>
        private bool CanSubmit()
        {
            // Typically, this code should never be seen as the publish package dialogs should not
            // be active when there is no authenticator
            if (dynamoViewModel == null || !dynamoViewModel.Model.PackageManagerClient.HasAuthProvider)
            {
                ErrorString = Resources.CannotSubmitPackage;
                return(false);
            }

            if (Name.Contains(@"\") || Name.Contains(@"/") || Name.Contains(@"*"))
            {
                ErrorString = Resources.PackageNameCannotContainTheseCharacters;
                return(false);
            }

            if (Name.Length < 3)
            {
                ErrorString = Resources.NameNeedMoreCharacters;
                return(false);
            }

            if (Description.Length <= 10)
            {
                ErrorString = Resources.DescriptionNeedMoreCharacters;
                return(false);
            }

            if (MajorVersion.Length <= 0)
            {
                ErrorString = Resources.MajorVersionNonNegative;
                return(false);
            }

            if (MinorVersion.Length <= 0)
            {
                ErrorString = Resources.MinorVersionNonNegative;
                return(false);
            }

            if (BuildVersion.Length <= 0)
            {
                ErrorString = Resources.BuildVersionNonNegative;
                return(false);
            }

            if (Double.Parse(BuildVersion) + Double.Parse(MinorVersion) + Double.Parse(MajorVersion) <= 0)
            {
                ErrorString = Resources.VersionValueGreaterThan0;
                return(false);
            }

            if (!PackageContents.Any())
            {
                ErrorString = Resources.PackageNeedAtLeastOneFile;
                return(false);
            }

            if (UploadState != PackageUploadHandle.State.Error)
            {
                ErrorString = "";
            }

            if (Uploading)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        private bool CheckPackageValidity()
        {
            if (Name.Contains(@"\") || Name.Contains(@"/") || Name.Contains(@"*"))
            {
                ErrorString = Resources.PackageNameCannotContainTheseCharacters;
                return(false);
            }

            if (Name.Length < 3)
            {
                ErrorString = Resources.NameNeedMoreCharacters;
                return(false);
            }

            if (Description.Length <= 10)
            {
                ErrorString = Resources.DescriptionNeedMoreCharacters;
                return(false);
            }

            if (MajorVersion.Length <= 0)
            {
                ErrorString = Resources.MajorVersionNonNegative;
                return(false);
            }

            if (MinorVersion.Length <= 0)
            {
                ErrorString = Resources.MinorVersionNonNegative;
                return(false);
            }

            if (BuildVersion.Length <= 0)
            {
                ErrorString = Resources.BuildVersionNonNegative;
                return(false);
            }

            if (Double.Parse(BuildVersion) + Double.Parse(MinorVersion) + Double.Parse(MajorVersion) <= 0)
            {
                ErrorString = Resources.VersionValueGreaterThan0;
                return(false);
            }

            if (!PackageContents.Any())
            {
                ErrorString = Resources.PackageNeedAtLeastOneFile;
                return(false);
            }

            if (UploadState != PackageUploadHandle.State.Error)
            {
                ErrorString = "";
            }

            if (Uploading)
            {
                return(false);
            }

            return(true);
        }
示例#3
0
        /// <summary>
        /// Delegate used to submit the element </summary>
        private bool CanSubmit()
        {
            // Typically, this code should never be seen as the publish package dialogs should not
            // be active when there is no authenticator
            if (dynamoViewModel == null || !dynamoViewModel.Model.PackageManagerClient.HasAuthenticator)
            {
                ErrorString = "Your package must contain at least one file.";
                return(false);
            }

            if (Name.Contains(@"\") || Name.Contains(@"/") || Name.Contains(@"*"))
            {
                ErrorString = @"The name of the package cannot contain /,\, or *.";
                return(false);
            }

            if (Name.Length < 3)
            {
                ErrorString = "Name must be at least 3 characters.";
                return(false);
            }

            if (Description.Length <= 10)
            {
                ErrorString = "Description must be longer than 10 characters.";
                return(false);
            }

            if (MajorVersion.Length <= 0)
            {
                ErrorString = "You must provide a Major version as a non-negative integer.";
                return(false);
            }

            if (MinorVersion.Length <= 0)
            {
                ErrorString = "You must provide a Minor version as a non-negative integer.";
                return(false);
            }

            if (BuildVersion.Length <= 0)
            {
                ErrorString = "You must provide a Build version as a non-negative integer.";
                return(false);
            }

            if (Double.Parse(BuildVersion) + Double.Parse(MinorVersion) + Double.Parse(MajorVersion) <= 0)
            {
                ErrorString = "At least one of your version values must be greater than 0.";
                return(false);
            }

            if (!PackageContents.Any())
            {
                ErrorString = "Your package must contain at least one file.";
                return(false);
            }

            if (UploadState != PackageUploadHandle.State.Error)
            {
                ErrorString = "";
            }

            if (Uploading)
            {
                return(false);
            }

            return(true);
        }