/// <summary> /// Initializes a new instance of the <see cref="RelationGroupTypeMappingDialogViewModel"/> class. /// </summary> public RelationGroupTypeMappingDialogViewModel(IEnumerable <RelationGroupType> relationGroupTypes, IReadOnlyDictionary <RelationGroupType, RelationGroupTypeMap> specRelationTypeMap, IReadOnlyDictionary <DatatypeDefinition, DatatypeDefinitionMap> datatypeDefMap, Iteration iteration, ISession session, IThingDialogNavigationService thingDialogNavigationService, string lang) : base(iteration, session, thingDialogNavigationService, lang) { this.BackCommand = ReactiveCommand.Create(); this.BackCommand.Subscribe(_ => this.ExecuteBackCommand()); var canExecuteOk = this.WhenAnyValue(x => x.CanOk); this.NextCommand = ReactiveCommand.Create(canExecuteOk); this.NextCommand.Subscribe(_ => this.ExecuteOkCommand()); this.CreateCategoryCommand = ReactiveCommand.Create(); this.CreateCategoryCommand.Subscribe(_ => this.ExecuteCreateCategoryCommand()); this.CreateBinaryRealationshipRuleCommand = ReactiveCommand.Create(); this.CreateBinaryRealationshipRuleCommand.Subscribe(_ => this.ExecuteCreateBinaryRelationshipRuleCommand()); this.SpecTypes = new ReactiveList <RelationGroupMappingRowViewModel>(); foreach (var specRelationType in relationGroupTypes) { var row = new RelationGroupMappingRowViewModel(specRelationType, iteration, datatypeDefMap, this.UpdateCanOk); this.SpecTypes.Add(row); } if (specRelationTypeMap != null) { this.PopulateRelationGroupTypeMapProperties(specRelationTypeMap); } this.UpdateCanOk(); }
/// <summary> /// Initializes a new instance of the <see cref="RelationGroupTypeMappingDialogViewModel"/> class. /// </summary> public RelationGroupTypeMappingDialogViewModel(IEnumerable <RelationGroupType> relationGroupTypes, IReadOnlyDictionary <RelationGroupType, RelationGroupTypeMap> specRelationTypeMap, IReadOnlyDictionary <DatatypeDefinition, DatatypeDefinitionMap> datatypeDefMap, Iteration iteration, ISession session, IThingDialogNavigationService thingDialogNavigationService, string lang) : base(iteration, session, thingDialogNavigationService, lang) { this.BackCommand = ReactiveCommand.Create(); this.BackCommand.Subscribe(_ => this.ExecuteBackCommand()); var canExecuteOk = this.WhenAnyValue(x => x.CanOk); this.NextCommand = ReactiveCommand.Create(canExecuteOk); this.NextCommand.Subscribe(_ => this.ExecuteOkCommand()); this.CreateCategoryCommand = ReactiveCommand.Create(); this.CreateCategoryCommand.Subscribe(_ => this.ExecuteCreateCategoryCommand()); this.CreateBinaryRealationshipRuleCommand = ReactiveCommand.Create(); this.CreateBinaryRealationshipRuleCommand.Subscribe(_ => this.ExecuteCreateBinaryRelationshipRuleCommand()); this.SpecTypes = new ReactiveList <RelationGroupMappingRowViewModel>(); foreach (var specRelationType in relationGroupTypes) { var row = new RelationGroupMappingRowViewModel(specRelationType, iteration, datatypeDefMap, this.UpdateCanOk); this.SpecTypes.Add(row); } if (specRelationTypeMap != null) { foreach (var pair in specRelationTypeMap) { var row = this.SpecTypes.Single(x => x.Identifiable == pair.Key); row.SelectedRules = new ReactiveList <ParameterizedCategoryRule>(row.PossibleRules.Where(r => pair.Value.Rules.Contains(r))); row.SelectedBinaryRelationshipRules = new ReactiveList <BinaryRelationshipRule>(row.PossibleBinaryRelationshipRules.Where(r => pair.Value.BinaryRelationshipRules.Contains(r))); row.SelectedCategories = new ReactiveList <CategoryComboBoxItemViewModel>(row.PossibleCategories.Where(c => pair.Value.Categories.Contains(c.Category))); } } this.UpdateCanOk(); }