private void ShowSetSampleResult(CommandError result, SampleRateEnum rate)
        {
            var r = result;

            if (r != CommandError.Success)
            {
                ViewWinUtils.ShowDefaultDialog($"Set Sample Rate {rate} failed: {r}");
            }
        }
Beispiel #2
0
        private void OnItemSelected(object sender, RoutedEventArgs e)
        {
            var item = sender as ListViewItem;

            if (item == null)
            {
                return;
            }
            AppLogger.Debug($"{item.Content},{item.TabIndex}");
            var viewmodel = DataContext as EEGExampleViewModel;

            if (viewmodel == null)
            {
                return;
            }
            var aresult = viewmodel.TestSingleImpedance(item.TabIndex);

            aresult?.ContinueWith(ar => {
                item.IsSelected = false;
                if (!ar.IsFaulted)
                {
                    var single = _currentState.LastSelectedSingleImpedanceChannel;
                    if (1 <= single && single <= _currentState.ChannelCount)
                    {
                        var ritem = ImpedanceListBox.Items[single - 1] as ListBoxItem;
                        if (ritem != null)
                        {
                            ritem.Content = $"Channel {single}: {_currentState.LastSingleImpedanceCode}";
                        }
                    }
                    ViewWinUtils.ShowDefaultDialog($"Test Single Channel Impedance #{single}: {_currentState.LastSingleImpedanceCode}");
                }
                else
                {
                    ViewWinUtils.ShowDefaultDialog(ar.Exception);
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }