private void OnLogLevelTypeClicked(LevelFilterMode mode) { CheckBox checkbox = null; switch (mode) { case LevelFilterMode.Debug: checkbox = cbDebug; break; case LevelFilterMode.Info: checkbox = cbInfo; break; case LevelFilterMode.Warning: checkbox = cbWarning; break; case LevelFilterMode.Error: checkbox = cbError; break; case LevelFilterMode.Assert: checkbox = cbAssert; break; } bool verbose = (levelFilter == LevelFilterMode.Verbose); if (mode != LevelFilterMode.Verbose) { if (checkbox != null) { if (checkbox.IsChecked ?? false) { if (!verbose) { levelFilter |= mode; } else { levelFilter = mode; } } else { levelFilter &= ~mode; } } } verbose = (levelFilter == LevelFilterMode.Verbose); cbVerbose.IsChecked = verbose; cbDebug.IsChecked = !verbose && levelFilter.HasFlag(LevelFilterMode.Debug); cbInfo.IsChecked = !verbose && levelFilter.HasFlag(LevelFilterMode.Info); cbWarning.IsChecked = !verbose && levelFilter.HasFlag(LevelFilterMode.Warning); cbError.IsChecked = !verbose && levelFilter.HasFlag(LevelFilterMode.Error); cbAssert.IsChecked = !verbose && levelFilter.HasFlag(LevelFilterMode.Assert); UpdateFilters(null, null); }
private void CbVerbose_Checked(object sender, RoutedEventArgs e) { levelFilter = (LevelFilterMode.Debug | LevelFilterMode.Info | LevelFilterMode.Warning | LevelFilterMode.Error | LevelFilterMode.Assert); OnLogLevelTypeClicked(levelFilter); }