/// <summary>
        /// Delete a Topic Subscription, if it exists, and indicate if the attempt was successful.
        /// </summary>
        public bool DeleteSubscription(string subscriptionName)
        {
            bool subscriptionDeleted = false;

            if (!string.IsNullOrWhiteSpace(subscriptionName))
            {
                string topicName = EnvironmentType.AzureTopicName();

                if (TopicExists)
                {
                    subscriptionDeleted = !_namespaceManager.SubscriptionExistsAsync(topicName, subscriptionName).Result;
                    if (!subscriptionDeleted)
                    {
                        _namespaceManager.DeleteSubscriptionAsync(topicName, subscriptionName).Wait();
                        subscriptionDeleted = !_namespaceManager.SubscriptionExistsAsync(topicName, subscriptionName).Result;
                    }
                }
                else
                {
                    subscriptionDeleted = true;
                }
            }

            return(subscriptionDeleted);
        }
 private void InitializeUi(EnvironmentType environment)
 {
     UpdateUiWithQueueNameForEnvironment(environment.MessageQueueName(), environment);
     UpdateUiWithTopicNameForEnvironment(environment.AzureTopicName(), environment);
     UpdateUiWithHostForEnvironment(environment);
     UpdateUiWithPrefixForEnvironment(environment);
     UpdateUiWithActionMessage(environment);
     ClearSuccessFailureListForEnvironment(environment);
 }
        /// <summary>
        /// Delete a Topic, if it exists, and indicate if the attempt was successful.
        /// </summary>
        public bool DeleteTopic()
        {
            string topicName   = EnvironmentType.AzureTopicName();
            bool   topicExists = TopicExists;

            if (topicExists)
            {
                _namespaceManager.DeleteTopicAsync(topicName).Wait();
                topicExists = TopicExists;
            }

            return(!topicExists);
        }
        /// <summary>
        /// Create a Topic Subscription, if it does not already exist, and indicate if the attempt was successful.
        /// </summary>
        public bool CreateSubscription(string subscriptionName)
        {
            bool subscriptionCreated = false;

            if (!string.IsNullOrWhiteSpace(subscriptionName))
            {
                string topicName = EnvironmentType.AzureTopicName();

                if (CreateTopic())
                {
                    subscriptionCreated = _namespaceManager.SubscriptionExistsAsync(topicName, subscriptionName).Result;
                    if (!subscriptionCreated)
                    {
                        _namespaceManager.CreateSubscriptionAsync(topicName, subscriptionName).Wait();
                        subscriptionCreated = _namespaceManager.SubscriptionExistsAsync(topicName, subscriptionName).Result;
                    }
                }
            }

            return(subscriptionCreated);
        }