示例#1
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            string name  = lbxItems.SelectedItem.ToString();
            int    index = lbxItems.SelectedIndex;

            _items.Remove(name);
            RefreshList();
            if (_items.Count == 0)
            {
                lbxItems.SelectedItem = null;
            }
            if (index >= _items.Count)
            {
                index -= 1;
            }
            lbxItems.SelectedIndex = index;
            OnRemoveClick();
        }
 /// <summary>
 /// Removes the specified device from our managed list.
 /// </summary>
 /// <param name="device">The device.</param>
 public virtual void RemoveDevice(IDevice device)
 {
     _devices.Remove(device);
 }