public SelectQueueDialog(IServiceBusDiscovery discovery, ServerConfig3 serverCfg, string[] queueNames) {
      InitializeComponent();

      _disc = discovery;
      _serverSettings = serverCfg.ConnectionSettings;

      Topmost = SbmqSystem.UIState.AlwaysOnTop;

      var qItems = queueNames.Select(n => new QueueListItem() { Name = n, Access = QueueAccess.Unknown }).ToList();
      lbQueues.ItemsSource = qItems;

      BackgroundWorker bw = new BackgroundWorker();
      bw.DoWork += (s, e) => {

        foreach( var q in qItems ) {
          if( _disc.CanAccessQueue(_serverSettings, q.Name) )
            q.Access = QueueAccess.RW;
          else {
            q.Access = QueueAccess.None;
          }
        }
      };
      bw.RunWorkerCompleted += (s, e) => {
        lbQueues.Items.Refresh();
      };

      bw.RunWorkerAsync();

    }
示例#2
0
 private void lbQueues_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (lbQueues.SelectedItem != null)
     {
         if (!_disc.CanAccessQueue(_server, lbQueues.SelectedItem as string))
         {
             lbInfo.Content  = "You don't have read access to queue " + lbQueues.SelectedItem;
             btnOK.IsEnabled = false;
         }
         else
         {
             btnOK.IsEnabled = true;
             lbInfo.Content  = string.Empty;
         }
     }
     else
     {
         btnOK.IsEnabled = false;
         lbInfo.Content  = string.Empty;
     }
 }
示例#3
0
        public SelectQueueDialog(IServiceBusDiscovery discovery, string server, string[] queueNames)
        {
            InitializeComponent();

            _disc   = discovery;
            _server = server;

            Topmost = SbmqSystem.UIState.AlwaysOnTop;

            var qItems = queueNames.Select(n => new QueueListItem()
            {
                Name = n, Access = QueueAccess.Unknown
            }).ToList();

            lbQueues.ItemsSource = qItems;

            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork += (s, e) => {
                foreach (var q in qItems)
                {
                    if (_disc.CanAccessQueue(_server, q.Name))
                    {
                        q.Access = QueueAccess.RW;
                    }
                    else
                    {
                        q.Access = QueueAccess.None;
                    }
                }
            };
            bw.RunWorkerCompleted += (s, e) => {
                lbQueues.Items.Refresh();
            };

            bw.RunWorkerAsync();
        }