show all adapter details in full-width dropdown

Display FriendlyName — Description — MAC for each device. Dropdown
spans full form width; layout simplified to vertical stack.
This commit is contained in:
2026-08-13 07:54:06 +00:00
parent f09028b135
commit d730028af9
+21 -9
View File
@@ -26,26 +26,37 @@ public partial class MainForm : Form
_sessions.ManifestReceived += entries => this.Invoke(() => PopulateList(entries));
foreach (var d in TunnelLink.ListDevices())
_deviceBox.Items.Add($"{d.Name} — {d.Interface?.FriendlyName ?? d.Interface?.Description}");
{
var friendly = d.Interface?.FriendlyName ?? "";
var desc = d.Interface?.Description ?? "";
var mac = d.MacAddress?.GetAddressBytes();
var macStr = mac != null
? string.Join(":", mac.Select(b => b.ToString("X2")))
: "??-??-??-??-??-??";
_deviceBox.Items.Add($"{friendly} — {desc} — {macStr}");
}
if (_deviceBox.Items.Count > 0)
_deviceBox.SelectedIndex = 0;
}
void InitializeComponents()
{
Controls.Add(new Label { Text = "Adapter:", Left = 12, Top = 12, AutoSize = true });
const int pad = 12;
_deviceBox.Left = 70; _deviceBox.Top = 9;
_deviceBox.Width = 330; _deviceBox.DropDownStyle = ComboBoxStyle.DropDownList;
_deviceBox.Left = pad; _deviceBox.Top = 12;
_deviceBox.Width = ClientSize.Width - pad * 2;
_deviceBox.DropDownStyle = ComboBoxStyle.DropDownList;
Controls.Add(_deviceBox);
_discoverBtn.Text = "Discover";
_discoverBtn.Left = 410; _discoverBtn.Top = 8; _discoverBtn.Width = 80;
_discoverBtn.Left = pad; _discoverBtn.Top = _deviceBox.Bottom + 8;
_discoverBtn.Width = 80;
_discoverBtn.Click += OnDiscover;
Controls.Add(_discoverBtn);
_listView.Left = 12; _listView.Top = 40;
_listView.Width = 478; _listView.Height = 250;
_listView.Left = pad; _listView.Top = _discoverBtn.Bottom + 8;
_listView.Width = ClientSize.Width - pad * 2;
_listView.Height = 220;
_listView.View = View.Details;
_listView.FullRowSelect = true;
_listView.CheckBoxes = true;
@@ -57,8 +68,9 @@ public partial class MainForm : Form
_listView.ItemChecked += OnItemChecked;
Controls.Add(_listView);
_statusLabel.Left = 12; _statusLabel.Top = 304;
_statusLabel.Width = 478; _statusLabel.AutoEllipsis = true;
_statusLabel.Left = pad; _statusLabel.Top = _listView.Bottom + 8;
_statusLabel.Width = ClientSize.Width - pad * 2;
_statusLabel.AutoEllipsis = true;
Controls.Add(_statusLabel);
}