File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,12 +125,12 @@ private void ApplyFilters()
125125 string selectedLevel = LevelFilterComboBox . SelectedItem as string ;
126126 string selectedClass = ClassFilterComboBox . SelectedItem as string ;
127127
128- // Use LINQ to apply filters more concisely
128+ // Use LINQ to filter LogEvents based on the selected criteria
129129 var filtered = ( ( LogViewModel ) DataContext ) . LogEvents . Where ( logEvent =>
130130 {
131- bool levelMatch = selectedLevel == "No filter" ||
131+ bool levelMatch = ( selectedLevel == "No filter" && logEvent . Level != "Warn" ) || // Exclude "Warn" unless explicitly selected
132132 logEvent . Level . Equals ( selectedLevel , StringComparison . OrdinalIgnoreCase ) ;
133- bool classMatch = selectedClass == "No filter" ||
133+ bool classMatch = selectedClass == "No filter" ||
134134 logEvent . Class . Equals ( selectedClass , StringComparison . OrdinalIgnoreCase ) ;
135135 return levelMatch && classMatch ;
136136 } ) . ToList ( ) ;
@@ -142,10 +142,12 @@ private void ApplyFilters()
142142 }
143143 catch ( Exception e )
144144 {
145- // ignored
145+ // Consider logging the exception or handling it as needed
146+ MessageBox . Show ( $ "Error applying filters: { e . Message } ", "Filter Error" ) ;
146147 }
147148 }
148149
150+
149151 private void LogEventViewerDataGrid_MouseDoubleClick ( object sender , MouseButtonEventArgs e )
150152 {
151153 if ( sender is DataGrid grid && grid . SelectedItem is LogEvent logEvent )
You can’t perform that action at this time.
0 commit comments