public void AddToActiveFilter() { if (SelectedInactiveFilter < 0) { return; } ActiveFilters.Add(InactiveFilters[SelectedInactiveFilter]); OnPropertyChanged("ActiveFilters"); }
//public async Task<SignalFiltering> StartSignalFilteringAsync() //{ // var filterName = ActiveFilters.FirstOrDefault().Key; // if (filterName != null) // return await StartSignalFilteringAsync(filterName); // return null; //} /// <summary> /// Start the signal filtering task /// </summary> public async Task <RealTimeSignalProcessing> StartRealTimeSignalProcessingAsync(SignalFilter filter, ISignalMontage montage) { var useMontage = montage; if (useMontage == null) { useMontage = SignalMontages.MakeDefaultMontage(NumberOfChannels); } var montageName = useMontage.Name; var filterName = filter == null ? "XXXDEFAULTXXX" : filter.Name; if (CancelTokenSource == null) { Log?.Invoke(this, new LogEventArgs(Name, this, "StartSignalFiltering", $"You must start the processor first.", LogLevel.ERROR)); return(null); } if (ActiveFilters.ContainsKey(RealTimeSignalProcessing.KeyName(filterName, montageName))) { return(ActiveFilters[RealTimeSignalProcessing.KeyName(filterName, montageName)]); } var newFilter = new RealTimeSignalProcessing(BoardId, SampleRate, filter, useMontage) { FilterBufferLength = 30, }; newFilter.GetRawChunk = GetRawChunk; newFilter.Log += OnComponentLog; ActiveFilters.Add(RealTimeSignalProcessing.KeyName(filterName, montageName), newFilter); await newFilter.StartRealTimeProcessingAsync(); return(newFilter); }