Ejemplo n.º 1
0
        /// <summary>
        /// The callback for the List-Queues action.
        /// </summary>
        /// <param name="sqsResponse">The <see cref="ISQSResponse"/>.</param>
        void GetListQueueResponse(object sender, ResponseEventArgs args)
        {
            AmazonSQSException sqsResponse = args.Response as AmazonSQSException;

            sqs.OnSQSResponse -= GetListQueueResponse;
            if (null != sqsResponse)
            {
                SQSErrorResponse(sqsResponse);
                this.Dispatcher.BeginInvoke(() =>
                {
                    this.QueueNames.Clear();
                });
                return;
            }
            ListQueuesResponse response = args.Response as ListQueuesResponse;

            if (null != response)
            {
                ListQueuesResult result = response.ListQueuesResult;
                if (null != result)
                {
                    this.Dispatcher.BeginInvoke(() =>
                    {
                        this.QueueNames.Clear();
                        System.Collections.Generic.List <string> queueList = result.QueueUrl.ToList();
                        foreach (string queueListEntry in queueList)
                        {
                            string[] parts   = queueListEntry.Split('/');
                            string queueName = parts[parts.Length - 1];
                            QueueNames.Add(queueName);

                            if (string.IsNullOrEmpty(QueuePath))
                            {
                                string queuePath = parts[parts.Length - 2];
                                QueuePath        = queuePath;
                            }
                        }
                    });
                }
            }
        }