Пример #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);
        }
Пример #2
0
        private bool ValidateInput()
        {
            if (String.IsNullOrEmpty(SourceTableName.Text))
            {
                MessageBox.Show("A source table name is required", "Source Table Name Required", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }
            else if (String.IsNullOrEmpty(DestTableName.Text))
            {
                MessageBox.Show("A destination table name is required", "Destination Table Name Required", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            string rules = "Table names must be valid DNS names, 3-63 characters in length, beginning with a letter and containing only alphanumeric characters. Table names are case-sensitive.";

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

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

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

            return(true);
        }
Пример #3
0
        private bool ValidateInput()
        {
            if (String.IsNullOrEmpty(QueueName.Text))
            {
                MessageBox.Show("A queue name is required", "Queue Name Required", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            if (!StorageAccountViewModel.ValidQueueName(QueueName.Text))
            {
                MessageBox.Show("The queue name is invalid.\r\n\r\nQueue 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 Queue Name", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            return(true);
        }
Пример #4
0
        private bool ValidateInput()
        {
            if (String.IsNullOrEmpty(TableName.Text))
            {
                MessageBox.Show("A table name is required", "Table Name Required", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            if (!StorageAccountViewModel.ValidTableName(TableName.Text))
            {
                MessageBox.Show("The table name is invalid.\r\n\r\nTable names must be valid DNS names, 3-63 characters in length, beginning with a letter and containing only alphanumeric characters. Table names are case-sensitive.", "Invalid Table Name", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(false);
            }

            return(true);
        }
Пример #5
0
        void ViewStorageAccount(StorageAccount account)
        {
            // See if the storage account is already displayed in a tab. If it is, select it.

            foreach (WorkspaceViewModel wvm in this.Workspaces)
            {
                if (wvm.DisplayName == account.Name)
                {
                    this.SetActiveWorkspace(wvm);
                    return;
                }
            }

            // Add a new workspace tab for the selected storage account.

            StorageAccountViewModel workspace = new StorageAccountViewModel(account);

            this.Workspaces.Add(workspace);

            this.SetActiveWorkspace(workspace);
        }
Пример #6
0
        public static string BlobName(CloudBlob blob)
        {
            string name = blob.Uri.LocalPath;

            name = StorageAccountViewModel.NormalizeBlobName(name);
            if (!name.StartsWith("/"))
            {
                name = "/" + name;
            }

            string containerName = StorageAccountViewModel.NormalizeContainerName(blob.Container.Name) + "/";

            if (!containerName.StartsWith("/"))
            {
                containerName = "/" + containerName;
            }

            if (name.StartsWith(containerName))
            {
                name = name.Substring(containerName.Length);
            }
            return(name);
        }