private void SelectThisGroup(RuleSelectStatus status) { selectStatus = status; if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("SelectStatus")); PropertyChanged(this, new PropertyChangedEventArgs("IsSelected")); } }
private void SelectChildren(RuleSelectStatus status) { if (status == RuleSelectStatus.Partial) { return; } foreach (Rule rule in this) { rule.SelectStatus = status; } }
public void ChangeSelectStatus(RuleSelectStatus status) { SelectThisGroup(status); if (status == RuleSelectStatus.Partial) { return; } foreach (Rule rule in this) { rule.ChangeSelectStatus(status); } }
private void SelectThisRule(RuleSelectStatus status) { if (_selectStatus == status) { return; } _selectStatus = status; if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("SelectStatus")); PropertyChanged(this, new PropertyChangedEventArgs("IsSelected")); } }
private void UpdateSelectStatus() { if (Count == 0) { return; } RuleSelectStatus status = this[0].SelectStatus; for (int i = 1; i < Count; i++) { if (this[i].SelectStatus != status) { SelectThisGroup(RuleSelectStatus.Partial); return; } } SelectThisGroup(status); }
/// <summary> /// Refresh feature mapping from target filter ruleGroup to mapping filter ruleGroup /// </summary> private void RefreshFeatureMapping() { // Not to refresh feature mapping when loading profile or the result of filtering cases will be changed if (!isLoadingProfile) { // If feature mapping table exists and we are updating from target filter to mapping filter if (featureMappingTable != null && !refreshStatus.HasFlag(RefreshStatus.ReverseFeatureMapping)) { refreshStatus |= RefreshStatus.FeatureMapping; // Get selected categories only to avoid refreshing for rule with partial selection List <string> categories = GetSelectedCategories(RuleGroupType == RuleType.Selector); // Unselect all features in mappingFilter mappingRuleGroup.SelectStatus = RuleSelectStatus.UnSelected; // Select mapping features in mappingFilter based on featureMappingTable foreach (string category in categories) { if (featureMappingTable.ContainsKey(category)) { List <Rule> ruleList = featureMappingTable[category]; foreach (Rule rule in ruleList) { // Check selection status from reverse feature mapping table string key = rule.CategoryList[0]; RuleSelectStatus currentSelectStatus = RuleSelectStatus.Selected; foreach (var r in mappingRuleGroup.reverseFeatureMappingTable[key]) { if (r.SelectStatus == RuleSelectStatus.UnSelected) { currentSelectStatus = RuleSelectStatus.Partial; break; } } rule.SelectStatus = currentSelectStatus; } } } refreshStatus &= ~RefreshStatus.FeatureMapping; } // If reverse feature mapping table exists and we are updating from mapping filter to target filter else if (reverseFeatureMappingTable != null && !targetRuleGroup.refreshStatus.HasFlag(RefreshStatus.FeatureMapping)) { List <string> categories = GetCategories(RuleGroupType == RuleType.Selector); targetRuleGroup.refreshStatus |= RefreshStatus.ReverseFeatureMapping; // Unselect all features in targetFilter targetRuleGroup.SelectStatus = RuleSelectStatus.UnSelected; // Set select status to partial for rule in target filter foreach (string category in categories) { if (reverseFeatureMappingTable.ContainsKey(category)) { List <Rule> ruleList = reverseFeatureMappingTable[category]; foreach (Rule rule in ruleList) { // Check selection status from feature mapping table bool noCaseSelected = true; RuleSelectStatus currentSelectStatus = RuleSelectStatus.Selected; string key = rule.CategoryList[0]; foreach (var r in targetRuleGroup.featureMappingTable[key]) { if (r.SelectStatus == RuleSelectStatus.UnSelected) { currentSelectStatus = RuleSelectStatus.Partial; } else { // RuleSelectStatus.Selected or RuleSelectStatus.Partial noCaseSelected = false; } } if (noCaseSelected) { rule.SelectStatus = RuleSelectStatus.UnSelected; } else { rule.SelectStatus = currentSelectStatus; } } } } targetRuleGroup.refreshStatus &= ~RefreshStatus.ReverseFeatureMapping; } } isLoadingProfile = false; }