static void IsSpecificTypeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { FilterContext cxt = sender as FilterContext; if (cxt == null) { return; } if (args.NewValue == args.OldValue) { return; } //this is triggered because user clicked 'Select All', then other checkboxes are being updated automatically; // so we don't need to do anything here. if (cxt.isSelectingAllClicking) { return; } cxt.isSelectingSpeificTypeClicking = true; try { bool bTrueFound = false; bool bFalseFound = false; if (cxt.IsShowingError) { bTrueFound = true; } else { bFalseFound = true; } if (cxt.IsShowingWarning) { bTrueFound = true; } else { bFalseFound = true; } if (cxt.IsShowingMessage) { bTrueFound = true; } else { bFalseFound = true; } if (cxt.IsShowingIgnoredWarning) { bTrueFound = true; } else { bFalseFound = true; } if (cxt.IsShowingIgnoredMessage) { bTrueFound = true; } else { bFalseFound = true; } if (bTrueFound && bFalseFound) { cxt.IsSelectingAll = null; } else if (bTrueFound) { cxt.IsSelectingAll = true; } else if (bFalseFound) { cxt.IsSelectingAll = false; } else { Debug.Assert(false); } } finally { cxt.isSelectingSpeificTypeClicking = false; } cxt.CheckIsValid(); }
static void IsSelectingAllChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { FilterContext cxt = sender as FilterContext; if (cxt == null) { return; } if (args.NewValue == args.OldValue) { return; } if (cxt.IsSelectingAll == null) { return; } //this is triggered because user clicked e.g. 'Error' box, then 'Selecting All' // is automatically being updated. In this case, we don't need to update anything. if (cxt.isSelectingSpeificTypeClicking) { return; } cxt.isSelectingAllClicking = true; try { if (cxt.IsShowingError != cxt.IsSelectingAll.Value) { cxt.IsShowingError = cxt.IsSelectingAll.Value; } if (cxt.IsShowingWarning != cxt.IsSelectingAll.Value) { cxt.IsShowingWarning = cxt.IsSelectingAll.Value; } if (cxt.IsShowingMessage != cxt.IsSelectingAll.Value) { cxt.IsShowingMessage = cxt.IsSelectingAll.Value; } if (cxt.IsShowingIgnoredWarning != cxt.IsSelectingAll.Value) { cxt.IsShowingIgnoredWarning = cxt.IsSelectingAll.Value; } if (cxt.IsShowingIgnoredMessage != cxt.IsSelectingAll.Value) { cxt.IsShowingIgnoredMessage = cxt.IsSelectingAll.Value; } } finally { cxt.isSelectingAllClicking = false; } cxt.CheckIsValid(); }