Example #1
0
        private bool ValidateInput()
        {
            if (String.IsNullOrEmpty(SourceContainerName.Text))
            {
                MessageBox.Show("A source container name is required", "Source Container Name Required", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }
            else if (String.IsNullOrEmpty(DestContainerName.Text))
            {
                MessageBox.Show("A destination container name is required", "Destination Container Name Required", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            string rules = "Container names must be 3-63 characters in length and may contain lower-case alphanumeric characters and dashes. Dashes must be preceded and followed by an alphanumeric character.";

            if (!StorageAccountViewModel.ValidContainerName(SourceContainerName.Text))
            {
                MessageBox.Show("The source container name is invalid.\r\n\r\n" + rules, "Invalid Source Container Name", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            if (!StorageAccountViewModel.ValidContainerName(DestContainerName.Text))
            {
                MessageBox.Show("The destination container name is invalid.\r\n\r\n" + rules, "Invalid Source Container Name", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            if (String.Compare(SourceContainerName.Text, DestContainerName.Text) == 0)
            {
                MessageBox.Show("The destination container name must be different from the original container name", "Destination Container Name Not Unique", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            return(true);
        }
Example #2
0
        private bool ValidateInput()
        {
            if (String.IsNullOrEmpty(ContainerName.Text))
            {
                MessageBox.Show("A container name is required", "Container Name Required", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            if (!StorageAccountViewModel.ValidContainerName(ContainerName.Text))
            {
                MessageBox.Show("The container name is invalid.\r\n\r\nContainer names must be 3-63 characters in length and may contain lower-case alphanumeric characters and dashes. Dashes must be preceded and followed by an alphanumeric character.", "Invalid Container Name", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            return(true);
        }