Exemple #1
0
        private void Filter(LoggerMessageFilterViewModel viewModel)
        {
            displayLoggerMessages.Clear();
            List <LoggerMessageViewModel> results = new List <LoggerMessageViewModel>();

            if (!viewModel.Level.Equals("All"))
            {
                var level = (LoggerLevel)Enum.Parse(typeof(LoggerLevel), viewModel.Level, true);
                results = loggerMessages.Where(m =>
                                               m.LoggerMessage.LoggerLevel == level &&
                                               (string.IsNullOrEmpty(viewModel.Include) ? true : m.ToString().IndexOf(viewModel.Include, StringComparison.InvariantCultureIgnoreCase) >= 0) &&
                                               (string.IsNullOrEmpty(viewModel.Exclude) ? true : m.ToString().IndexOf(viewModel.Exclude, StringComparison.InvariantCultureIgnoreCase) < 0) &&
                                               (viewModel.Category.Equals("All") ? true : m.LoggerMessage.Category.Equals(viewModel.Category, StringComparison.InvariantCultureIgnoreCase))
                                               ).ToList();
            }
            else
            {
                results = loggerMessages.Where(m =>
                                               (string.IsNullOrEmpty(viewModel.Include) ? true : m.ToString().IndexOf(viewModel.Include, StringComparison.InvariantCultureIgnoreCase) >= 0) &&
                                               (string.IsNullOrEmpty(viewModel.Exclude) ? true : m.ToString().IndexOf(viewModel.Exclude, StringComparison.InvariantCultureIgnoreCase) < 0) &&
                                               (viewModel.Category.Equals("All") ? true : m.LoggerMessage.Category.Equals(viewModel.Category, StringComparison.InvariantCultureIgnoreCase))
                                               ).ToList();
            }
            foreach (var item in results)
            {
                displayLoggerMessages.Add(item);
            }

            if (SearchFinished != null)
            {
                SearchFinished();
            }
        }
Exemple #2
0
 public LoggerMessageFilterWindow()
 {
     InitializeComponent();
     viewModel   = new LoggerMessageFilterViewModel();
     DataContext = viewModel;
 }