private void Queue_AddItem(object sender, QueueListItemRoutedEventArgs e) { QueueListControl s = sender as QueueListControl; var srv = CurrentServer; SelectQueueDialog dlg = new SelectQueueDialog(GetDiscoveryService(srv), srv, GetAllQueueNames().Except(s.GetItems().Select(i => i.Name).ToList()).OrderBy(name => name).ToArray()); dlg.Title = "Select " + s.Title.Remove(s.Title.Length - 1); dlg.Owner = this; if (dlg.ShowDialog() == true) { e.Handled = true; dlg.SelectedQueueNames.ForEach(queueName => { var color = !s.Name.EndsWith("Errors") ? QueueColorManager.GetRandomAvailableColor() : Color.FromArgb(QueueColorManager.RED); e.Items.Add(new QueueListControl.QueueListItem(queueName, color)); }); } }
private void Queue_AddItem_1(object sender, QueueListItemRoutedEventArgs e) { QueueListControl s = sender as QueueListControl; SelectQueueDialog dlg = new SelectQueueDialog(GetDiscoveryService(), cbServers.SelectedValue as string, GetAllQueueNames().Except(s.GetItems().Select(i => i.Name).ToList()).OrderBy(name => name).ToArray()); dlg.Title = "Select " + s.Title.Remove(s.Title.Length - 1); dlg.Owner = this; if (dlg.ShowDialog() == true) { e.Handled = true; var color = !s.Name.EndsWith("Errors") ? QueueColorManager.GetRandomAvailableColor() : System.Drawing.Color.FromArgb(QueueColorManager.RED); e.Item = new QueueListControl.QueueListItem(dlg.SelectedQueueName, color); } }