private async Task OpenCompoundEditDialog(CompoundMatchRuleViewModel matchRule) { await DialogService.OpenFullPageAsync(typeof(CompoundMatchRuleEditDialog), new MatDialogOptions { Attributes = new Dictionary <string, object> { [nameof(CompoundMatchRuleEditDialog.CompoundRule)] = matchRule, }, }).ConfigureAwait(true); }
private void AddCompoundRule() { var compoundRule = new CompoundMatchRuleViewModel(); compoundRule.ChildRules.Add(new SinglePropertyMatchRuleViewModel { InEditMode = true, }); CompoundRule.ChildRules.Add(compoundRule); }
public static IEnumerable <BaseMatchRuleViewModel> ToViewModel(this IEnumerable <ICatalogueItemMatchRule> matchRules) => matchRules .Select <ICatalogueItemMatchRule, BaseMatchRuleViewModel>(rule => { switch (rule.MatchRuleType) { case MatchRuleType.SingleProperty: { var singlePropertyMatchRule = (SinglePropertyCatalogueItemMatchRule)rule; return(new SinglePropertyMatchRuleViewModel { MatchType = singlePropertyMatchRule.MatchType, Property = singlePropertyMatchRule.Property, Value = singlePropertyMatchRule.Value, }); } case MatchRuleType.Compound: { var compoundMatchRule = (CompoundCatalogueItemMatchRule)rule; var result = new CompoundMatchRuleViewModel { MatchType = compoundMatchRule.MatchType, }; result.ChildRules.AddRange(compoundMatchRule.ChildRules.ToViewModel()); return(result); } default: throw new InvalidOperationException($"Unkown MatchRuleType {rule.MatchRuleType}"); } });