Beispiel #1
0
        public FiltersInput(ActiveFilters activeFilters)
        {
            InitializeComponent();

            this.Filters = activeFilters;
            DataContext  = this;
        }
 public void DeleteAllActiveFilters()
 {
     if (System.Windows.MessageBox.Show("Are you sure you want to remove all active filters?", "Remove all active filters", System.Windows.MessageBoxButton.YesNo) == System.Windows.MessageBoxResult.Yes)
     {
         ActiveFilters.Clear();
         SelectedActiveFilter = -1;
     }
 }
        public void MoveActiveFilterDown()
        {
            if (SelectedActiveFilter >= ActiveFilters.Count - 1)
            {
                return;
            }

            ActiveFilters.Move(SelectedActiveFilter, SelectedActiveFilter + 1);
        }
        public void MoveActiveFilterUp()
        {
            if (SelectedActiveFilter <= 0)
            {
                return;
            }

            ActiveFilters.Move(SelectedActiveFilter, SelectedActiveFilter - 1);
        }
Beispiel #5
0
 public void Clear()
 {
     FilteredResults.Clear();
     _allResults.Clear();
     ActiveFilters.Clear();
     foreach (var filter in _allFilters)
     {
         filter.Clear();
     }
 }
Beispiel #6
0
        /// <summary>
        /// Stop a specific signal filter task
        /// </summary>
        public async Task StopSignalFilteringAsync(string filterName)
        {
            if (ActiveFilters.ContainsKey(filterName))
            {
                await ActiveFilters[filterName].StopRealTimeProcessingAsyncAsync();
                ActiveFilters[filterName].Log -= OnComponentLog;
            }

            ActiveFilters.Remove(filterName);
        }
Beispiel #7
0
        /// <summary>
        /// Stop all signal filtering tasks
        /// </summary>
        public async Task StopRealTimeSignalProcessingAsync()
        {
            foreach (var nextFilter in ActiveFilters)
            {
                await nextFilter.Value.StopRealTimeProcessingAsyncAsync();

                nextFilter.Value.Log -= OnComponentLog;
            }
            ActiveFilters.Clear();
        }
        public void AddToActiveFilter()
        {
            if (SelectedInactiveFilter < 0)
            {
                return;
            }

            ActiveFilters.Add(InactiveFilters[SelectedInactiveFilter]);
            OnPropertyChanged("ActiveFilters");
        }
Beispiel #9
0
        public void ApplyFilters()
        {
            var activeFilters = _allFilters.SelectMany(i => i.Where(e => e.IsChecked));

            FilteredResults.AddRemoveRange(activeFilters.SelectMany(i => i.Parents).Distinct());
            if (FilteredResults.Count == 0 && _allFilters.SelectMany(i => i.Where(e => e.IsChecked)).Count() == 0)
            {
                FilteredResults.AddRemoveRange(_allResults);
            }
            ActiveFilters.AddRemoveRange(activeFilters);
        }
        public void RemoveFromActiveFilter()
        {
            if (SelectedActiveFilter < 0)
            {
                return;
            }

            ActiveFilters.RemoveAt(SelectedActiveFilter);
            OnPropertyChanged("ActiveFilters");


            if (SelectedActiveFilter >= ActiveFilters.Count - 1)
            {
                SelectedActiveFilter--;
            }
        }
Beispiel #11
0
        //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);
        }