Ejemplo n.º 1
0
        protected SourceFilterViewModel Find(IReadOnlyList <string> loggerNames, SourceFilterViewModel parent, int index)
        {
            if (loggerNames.Count <= index)
            {
                return(null);
            }

            var name = loggerNames[index];
            var sourceFilterViewModel = parent.Children.FirstOrDefault(s => s.Name == name);

            if (sourceFilterViewModel == null)
            {
                var newSourceFilter = new SourceFilter(parent.sourceFilter)
                {
                    Name = name
                };
                parent.sourceFilter.Children.Add(newSourceFilter);

                sourceFilterViewModel = new SourceFilterViewModel(newSourceFilter, logPaneServices);
                parent.Children.Add(sourceFilterViewModel);
            }

            var source = Find(loggerNames, sourceFilterViewModel, index + 1);

            return(source ?? sourceFilterViewModel);
        }
Ejemplo n.º 2
0
        private void AddChild(SourceFilter child)
        {
            var childViewModel = new SourceFilterViewModel(child, logPaneServices);

            Children.Add(childViewModel);

            foreach (var subChild in child.Children)
            {
                childViewModel.AddChild(subChild);
            }
        }
Ejemplo n.º 3
0
        public ProfileFiltersViewModel(FiltersProfile filtersProfile, LogPaneServices logPaneServices)
        {
            FiltersProfile       = filtersProfile;
            this.logPaneServices = logPaneServices;

            LogLevels = new BindableCollection <LogLevelFilterViewModel>(
                FiltersProfile.LogLevels.Select(ll => new LogLevelFilterViewModel(logPaneServices, ll)));

            MinLogLevel = LogLevels.First();

            SourceFilterRootViewModel = new SourceFilterViewModel(filtersProfile.SourceFilterRoot, logPaneServices);
        }