private void RefreshImpedanceCodes() { for (var i = 0; i < ImpedanceListBox.Items.Count; i++) { var item = ImpedanceListBox.Items[i] as ListBoxItem; if (item != null) { var code = _currentState.GetChannelImpedance(i); item.Content = $"Channel {i+1}: {code}"; } } }
/// <summary> /// 显示/测试采样通道的阻抗值 /// </summary> /// <param name="state"></param> public ImpedanceViewWin(BrainDevState state) { BrainDeviceManager.OnConnected += OnReconnect; InitializeComponent(); _currentState = state; for (int i = 0; i < _currentState.ChannelCount; i++) { var code = _currentState.GetChannelImpedance(i); ListBoxItem item = new ListViewItem { Content = $"Channel {i + 1}: {code}", TabIndex = i + 1 }; ImpedanceListBox.Items.Add(item); item.Selected += OnItemSelected; } _uithread = Dispatcher.CurrentDispatcher; _unsubscriber = BrainDeviceManager.BrainDeviceState.Subscribe(OnDevStateChanged, () => { _uithread.InvokeAsync(OnDisconnect); }); }