public void Verify_that_the_pluginservice_settings_are_deserialized_as_expected() { File.Copy(Path.Combine(TestContext.CurrentContext.TestDirectory, "Settings", "expectedSettings.settings.json"), this.expectedSettingsPath, true); this.settings = this.pluginSettingsService.Read <RelationshipMatrixPluginSettings>(); var expectedClassKinds = new List <ClassKind> { ClassKind.ElementDefinition, ClassKind.ElementUsage, ClassKind.NestedElement, ClassKind.RequirementsSpecification, ClassKind.RequirementsGroup, ClassKind.Requirement }; var expectedDisplayKinds = new List <DisplayKind> { DisplayKind.Name, DisplayKind.ShortName }; Assert.That(this.settings.PossibleClassKinds, Is.EquivalentTo(expectedClassKinds)); Assert.That(this.settings.PossibleDisplayKinds, Is.EquivalentTo(expectedDisplayKinds)); }
public void SetUp() { this.pluginSettingsService = new PluginSettingsService(); this.expectedSettingsPath = Path.Combine( this.pluginSettingsService.AppDataFolder, this.pluginSettingsService.Cdp4ConfigurationDirectoryFolder, "CDP4RelationshipMatrix.settings.json"); this.relationshipMatrixModule = new RelationshipMatrixModule(null, null, null, null, null); this.settings = new RelationshipMatrixPluginSettings { PossibleClassKinds = new List <ClassKind> { ClassKind.ElementDefinition, ClassKind.ElementUsage, ClassKind.NestedElement, ClassKind.RequirementsSpecification, ClassKind.RequirementsGroup, ClassKind.Requirement }, PossibleDisplayKinds = new List <DisplayKind> { DisplayKind.Name, DisplayKind.ShortName } }; }
/// <summary> /// Initializes a new instance of the <see cref="MatrixViewModel" /> class /// </summary> /// <param name="session">The current session</param> /// <param name="iteration">The current iteration</param> /// <param name="settings">The module settings</param> public MatrixViewModel(ISession session, Iteration iteration, RelationshipMatrixPluginSettings settings) { this.filterStringService = ServiceLocator.Current.GetInstance <IFilterStringService>(); this.IsDeprecatedDisplayed = this.filterStringService.ShowDeprecatedThings; this.Disposables = new List <IDisposable>(); this.Records = new ReactiveList <IDictionary <string, MatrixCellViewModel> >(); this.Columns = new ReactiveList <ColumnDefinition>(); this.session = session; this.iteration = iteration; this.CreateSourceYToSourceXLink = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.CanCreateSourceYToSourceX), x => this.CreateRelationship(RelationshipDirectionKind.RowThingToColumnThing), RxApp.MainThreadScheduler); this.CreateSourceXToSourceYLink = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.CanCreateSourceXToSourceY), x => this.CreateRelationship(RelationshipDirectionKind.ColumnThingToRowThing), RxApp.MainThreadScheduler); this.DeleteSourceYToSourceXLink = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.CanDelete), x => this.DeleteRelationship(RelationshipDirectionKind.RowThingToColumnThing), RxApp.MainThreadScheduler); this.DeleteSourceXToSourceYLink = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.CanDelete), x => this.DeleteRelationship(RelationshipDirectionKind.ColumnThingToRowThing), RxApp.MainThreadScheduler); this.DeleteAllRelationships = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.CanDelete), x => this.DeleteRelationship(RelationshipDirectionKind.BiDirectional), RxApp.MainThreadScheduler); this.ProcessCellCommand = ReactiveCommand.CreateAsyncTask(x => this.ProcessCellCommandExecute((List <object>)x), RxApp.MainThreadScheduler); this.ProcessAltCellCommand = ReactiveCommand.CreateAsyncTask(x => this.ProcessAltCellCommandExecute((List <object>)x), RxApp.MainThreadScheduler); this.ProcessAltControlCellCommand = ReactiveCommand.CreateAsyncTask( x => this.ProcessAltControlCellCommandExecute((List <object>)x), RxApp.MainThreadScheduler); this.ToggleColumnHighlightCommand = ReactiveCommand.CreateAsyncTask( x => this.ToggleColumnHighlightCommandExecute(x as GridColumn), RxApp.MainThreadScheduler); this.MouseDownCommand = ReactiveCommand.Create(); this.MouseDownCommand.Subscribe(x => this.MouseDownCommandExecute((MatrixAddress)x)); this.SubscribeCommandExceptions(); this.WhenAnyValue(x => x.SelectedCell).Subscribe(_ => this.ComputeCommandCanExecute()); }
/// <summary> /// Initializes a new instance of the <see cref="SourceConfigurationViewModel"/> class /// </summary> /// <param name="session">The current session</param> /// <param name="iteration">The current iteration</param> /// <param name="onUpdateAction">The action to perform on update</param> /// <param name="onLightUpdateAction">The action to perform on update without need to rebuild relationship configuration</param> /// <param name="settings">The module settings</param> public SourceConfigurationViewModel(ISession session, Iteration iteration, Action onUpdateAction, Action onLightUpdateAction, RelationshipMatrixPluginSettings settings) : base(session, iteration, onUpdateAction, settings) { this.OnLightUpdateAction = onLightUpdateAction; this.possibleClassKind.AddRange(this.PluginSetting.PossibleClassKinds.OrderBy(x => x.ToString())); this.possibleDisplayKinds.AddRange(this.PluginSetting.PossibleDisplayKinds.OrderBy(x => x.ToString())); this.PossibleCategories = new ReactiveList <Category>(); this.PossibleCategories.ChangeTrackingEnabled = true; this.SelectedCategories = new List <Category>(); this.PossibleOwners = new ReactiveList <DomainOfExpertise>(); this.PossibleOwners.ChangeTrackingEnabled = true; this.SelectedOwners = new List <DomainOfExpertise>(); // default boolean operator is AND this.SelectedBooleanOperatorKind = CategoryBooleanOperatorKind.AND; this.IncludeSubcategories = true; this.WhenAnyValue(x => x.SelectedClassKind).Skip(1).Subscribe(_ => { this.PopulatePossibleCategories(); this.PopulatePossibleOwners(); this.OnUpdateAction(); }); this.WhenAnyValue(x => x.SelectedDisplayKind).Skip(1).Subscribe(_ => { this.OnLightUpdateAction(); }); this.WhenAnyValue(x => x.SelectedSortKind).Skip(1).Subscribe(_ => { this.OnLightUpdateAction(); }); this.WhenAnyValue(x => x.SelectedSortOrder).Skip(1).Subscribe(_ => { this.OnLightUpdateAction(); }); this.WhenAnyValue(x => x.SelectedCategories).Skip(1).Subscribe(_ => this.OnLightUpdateAction()); this.WhenAnyValue(x => x.SelectedOwners).Skip(1).Subscribe(_ => this.OnLightUpdateAction()); this.WhenAnyValue(x => x.SelectedBooleanOperatorKind).Skip(1).Subscribe(_ => this.OnLightUpdateAction()); this.WhenAnyValue(x => x.IncludeSubcategories).Skip(1).Subscribe(_ => this.OnLightUpdateAction()); var categorySubscription = CDPMessageBus.Current .Listen <ObjectChangedEvent>(typeof(Category)) .Where(objectChange => objectChange.ChangedThing.Cache == this.Session.Assembler.Cache) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => { this.PopulatePossibleCategories(); this.OnLightUpdateAction(); }); this.Disposables.Add(categorySubscription); }
/// <summary> /// Initializes a new instance of the <see cref="RelationshipConfigurationViewModel"/> /// </summary> /// <param name="session">The current session</param> /// <param name="thingDialogNavigationService"> /// The <see cref="IThingDialogNavigationService"/> used to navigate to details dialog of a <see cref="Thing"/> /// </param> /// <param name="iteration">The current iteration</param> /// <param name="action">The action to perform on update</param> /// <param name="settings">The module settings</param> public RelationshipConfigurationViewModel(ISession session, IThingDialogNavigationService thingDialogNavigationService, Iteration iteration, Action action, RelationshipMatrixPluginSettings settings) : base(session, iteration, action, settings) { this.thingDialogNavigationService = thingDialogNavigationService; this.PossibleRules = new ReactiveList <BinaryRelationshipRule>(); this.WhenAnyValue(x => x.SelectedRule).Skip(1).Subscribe(_ => this.OnUpdateAction()); this.InitializeCommands(); }
/// <summary> /// Initializes a new instance of the <see cref="RelationshipConfigurationViewModel"/> /// </summary> /// <param name="session">The current session</param> /// <param name="thingDialogNavigationService"> /// The <see cref="IThingDialogNavigationService"/> used to navigate to details dialog of a <see cref="Thing"/> /// </param> /// <param name="iteration">The current iteration</param> /// <param name="action">The action to perform on update</param> /// <param name="settings">The module settings</param> /// <param name="source">The source <see cref="RelationshipConfiguration"/></param> /// <param name="sourceY">The <see cref="ClassKind"/> of source Y</param> /// <param name="sourceX">The <see cref="ClassKind"/> of source X</param> public RelationshipConfigurationViewModel(ISession session, IThingDialogNavigationService thingDialogNavigationService, Iteration iteration, Action action, RelationshipMatrixPluginSettings settings, RelationshipConfiguration source, ClassKind?sourceY, ClassKind?sourceX) : this(session, thingDialogNavigationService, iteration, action, settings) { this.PopulatePossibleRules(sourceY, sourceX); if (source.SelectedRule != null) { this.SelectedRule = this.PossibleRules.SingleOrDefault(x => x.Iid == source.SelectedRule); } }
/// <summary> /// Initializes a new instance of the <see cref="RelationshipMatrixViewModel" /> class /// </summary> /// <param name="iteration">The associated <see cref="Iteration" /></param> /// <param name="session">The session</param> /// <param name="thingDialogNavigationService">The thing Dialog Navigation Service</param> /// <param name="panelNavigationService">The <see cref="IPanelNavigationService" /></param> /// <param name="dialogNavigationService">The <see cref="IDialogNavigationService" /></param> /// <param name="pluginService">The <see cref="IPluginSettingsService" /></param> public RelationshipMatrixViewModel(Iteration iteration, ISession session, IThingDialogNavigationService thingDialogNavigationService, IPanelNavigationService panelNavigationService, IDialogNavigationService dialogNavigationService, IPluginSettingsService pluginService) : base(iteration, session, thingDialogNavigationService, panelNavigationService, dialogNavigationService, pluginService) { this.Caption = "Relationship Matrix"; this.ShowDirectionality = true; this.ShowRelatedOnly = false; this.IsBusy = false; this.ToolTip = $"{((EngineeringModel) this.Thing.Container).EngineeringModelSetup.Name}\n{this.Thing.IDalUri}\n{this.Session.ActivePerson.Name}"; this.settings = this.PluginSettingsService.Read <RelationshipMatrixPluginSettings>(); this.SavedConfigurations = new ReactiveList <SavedConfiguration> { ChangeTrackingEnabled = true }; this.ReloadSavedConfigurations(); this.SourceYConfiguration = new SourceConfigurationViewModel(session, iteration, this.UpdateRelationshipConfiguration, this.BuildRelationshipMatrix, this.settings); this.SourceXConfiguration = new SourceConfigurationViewModel(session, iteration, this.UpdateRelationshipConfiguration, this.BuildRelationshipMatrix, this.settings); this.RelationshipConfiguration = new RelationshipConfigurationViewModel(session, thingDialogNavigationService, iteration, this.BuildRelationshipMatrix, this.settings); this.Matrix = new MatrixViewModel(this.Session, this.Thing, this.settings); this.Disposables.Add(this.SourceYConfiguration); this.Disposables.Add(this.SourceXConfiguration); this.Disposables.Add(this.RelationshipConfiguration); this.Disposables.Add(this.Matrix); var model = (EngineeringModel)this.Thing.TopContainer; this.modelSetup = model.EngineeringModelSetup; this.iterationSetup = this.Thing.IterationSetup; this.CurrentIteration = this.iterationSetup.IterationNumber; this.ActiveParticipant = this.modelSetup.Participant.Single(x => x.Person == this.Session.ActivePerson); this.AddSubscriptions(); this.UpdateProperties(); }
/// <summary> /// Reloads the saved configurations. /// </summary> private void ReloadSavedConfigurations() { this.settings = this.PluginSettingsService.Read <RelationshipMatrixPluginSettings>(); this.SavedConfigurations = new ReactiveList <SavedConfiguration>(this.settings.SavedConfigurations); this.SavedConfigurations.Insert(0, new SavedConfiguration() { Name = "(Clear)", RelationshipConfiguration = new RelationshipConfiguration(), ShowRelatedOnly = false, ShowDirectionality = true, SourceConfigurationX = new SourceConfiguration(), SourceConfigurationY = new SourceConfiguration() }); }
/// <summary> /// Initializes a new instance of the <see cref="SourceConfigurationViewModel"/> class /// </summary> /// <param name="session">The current session</param> /// <param name="iteration">The current iteration</param> /// <param name="onUpdateAction">The action to perform on update</param> /// <param name="onLightUpdateAction">The action to perform on update without need to rebuild relationship configiguration</param> /// <param name="settings">The module settings</param> /// <param name="source">The source <see cref="SourceConfiguration"/></param> public SourceConfigurationViewModel(ISession session, Iteration iteration, Action onUpdateAction, Action onLightUpdateAction, RelationshipMatrixPluginSettings settings, SourceConfiguration source) : this(session, iteration, onUpdateAction, onLightUpdateAction, settings) { this.IncludeSubcategories = source.IncludeSubcategories; this.SelectedBooleanOperatorKind = source.SelectedBooleanOperatorKind; this.SelectedClassKind = source.SelectedClassKind; this.SelectedDisplayKind = source.SelectedDisplayKind; this.SelectedSortKind = source.SelectedSortKind; this.selectedSortOrder = source.SortOrder; this.OnLightUpdateAction = onLightUpdateAction; // populate selected categories var categories = new List <Category>(); foreach (var iid in source.SelectedCategories) { var category = this.PossibleCategories.FirstOrDefault(c => c.Iid == iid); if (category != null) { categories.Add(category); } } this.SelectedCategories = new List <Category>(categories); // populate selected owners var owners = new List <DomainOfExpertise>(); foreach (var iid in source.SelectedOwners) { var domainOfExpertise = this.PossibleOwners.FirstOrDefault(d => d.Iid == iid); if (domainOfExpertise != null) { owners.Add(domainOfExpertise); } } this.SelectedOwners = new List <DomainOfExpertise>(owners); }
public virtual void Setup() { RxApp.MainThreadScheduler = Scheduler.CurrentThread; this.serviceLocator = new Mock <IServiceLocator>(); ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object); this.filterStringService = new Mock <IFilterStringService>(); this.panelNavigationService = new Mock <IPanelNavigationService>(); this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>(); this.dialogNavigationService = new Mock <IDialogNavigationService>(); this.dialogNavigationService.Setup(x => x.NavigateModal(It.IsAny <ManageConfigurationsDialogViewModel>())) .Returns(new ManageConfigurationsResult(true)); this.dialogNavigationService.Setup(x => x.NavigateModal(It.IsAny <SavedConfigurationDialogViewModel>())) .Returns(new SavedConfigurationResult(true)); this.permissionService = new Mock <IPermissionService>(); this.pluginService = new Mock <IPluginSettingsService>(); this.session = new Mock <ISession>(); this.serviceLocator.Setup(x => x.GetInstance <IFilterStringService>()).Returns(this.filterStringService.Object); this.assembler = new Assembler(this.uri); this.sitedir = new SiteDirectory(Guid.NewGuid(), this.assembler.Cache, this.uri); this.engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.iterationSetup = new IterationSetup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.srdl = new SiteReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri); this.mrdl = new ModelReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri) { RequiredRdl = this.srdl }; this.person = new Person(Guid.NewGuid(), this.assembler.Cache, this.uri); this.domain = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "domain", ShortName = "domain" }; this.participant = new Participant(Guid.NewGuid(), this.assembler.Cache, this.uri) { Person = this.person }; this.catEd1 = new Category(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "cat1", ShortName = "cat1" }; this.catEd2 = new Category(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "cat2", ShortName = "cat2" }; this.catEd3 = new Category(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "cat3sub1", ShortName = "cat3sub1", SuperCategory = new List <Category> { this.catEd1 } }; this.catEd4 = new Category(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "cat4sub3", ShortName = "cat3sub4", SuperCategory = new List <Category> { this.catEd3 } }; this.catRel = new Category(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "catrel", ShortName = "catrel" }; this.catEd1.PermissibleClass.Add(ClassKind.ElementDefinition); this.catEd2.PermissibleClass.Add(ClassKind.ElementDefinition); this.catEd3.PermissibleClass.Add(ClassKind.ElementDefinition); this.catEd4.PermissibleClass.Add(ClassKind.ElementDefinition); this.catRel.PermissibleClass.Add(ClassKind.BinaryRelationship); this.rule = new BinaryRelationshipRule(Guid.NewGuid(), this.assembler.Cache, this.uri) { SourceCategory = this.catEd1, TargetCategory = this.catEd2, RelationshipCategory = this.catRel, Name = "rel", ShortName = "rel" }; this.sitedir.Model.Add(this.engineeringModelSetup); this.sitedir.SiteReferenceDataLibrary.Add(this.srdl); this.sitedir.Person.Add(this.person); this.sitedir.Domain.Add(this.domain); this.engineeringModelSetup.IterationSetup.Add(this.iterationSetup); this.engineeringModelSetup.RequiredRdl.Add(this.mrdl); this.engineeringModelSetup.Participant.Add(this.participant); this.engineeringModelSetup.ActiveDomain.Add(this.domain); this.srdl.DefinedCategory.Add(this.catEd1); this.srdl.DefinedCategory.Add(this.catEd2); this.srdl.DefinedCategory.Add(this.catEd3); this.srdl.DefinedCategory.Add(this.catEd4); this.srdl.DefinedCategory.Add(this.catRel); this.srdl.Rule.Add(this.rule); this.model = new EngineeringModel(Guid.NewGuid(), this.assembler.Cache, this.uri) { EngineeringModelSetup = this.engineeringModelSetup }; this.iteration = new Iteration(Guid.NewGuid(), this.assembler.Cache, this.uri) { IterationSetup = this.iterationSetup }; this.elementDef11 = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "ed11", ShortName = "ed11", Owner = this.domain }; this.elementDef12 = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "ed12", ShortName = "ed12", Owner = this.domain }; this.elementDef21 = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "ed21", ShortName = "ed21", Owner = this.domain }; this.elementDef22 = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "ed22", ShortName = "ed22", Owner = this.domain }; this.elementDef31 = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "ed31", ShortName = "ed31", Owner = this.domain }; this.elementDef11.Category.Add(this.catEd1); this.elementDef12.Category.Add(this.catEd3); this.elementDef21.Category.Add(this.catEd2); this.elementDef22.Category.Add(this.catEd4); this.elementDef31.Category.Add(this.catEd1); this.elementDef31.Category.Add(this.catEd2); this.model.Iteration.Add(this.iteration); this.iteration.Element.Add(this.elementDef11); this.iteration.Element.Add(this.elementDef12); this.iteration.Element.Add(this.elementDef21); this.iteration.Element.Add(this.elementDef22); this.iteration.Element.Add(this.elementDef31); this.assembler.Cache.TryAdd(new CacheKey(this.sitedir.Iid, null), new Lazy <Thing>(() => this.sitedir)); this.assembler.Cache.TryAdd(new CacheKey(this.engineeringModelSetup.Iid, null), new Lazy <Thing>(() => this.engineeringModelSetup)); this.assembler.Cache.TryAdd(new CacheKey(this.srdl.Iid, null), new Lazy <Thing>(() => this.srdl)); this.assembler.Cache.TryAdd(new CacheKey(this.iterationSetup.Iid, null), new Lazy <Thing>(() => this.iterationSetup)); this.assembler.Cache.TryAdd(new CacheKey(this.mrdl.Iid, null), new Lazy <Thing>(() => this.mrdl)); this.assembler.Cache.TryAdd(new CacheKey(this.person.Iid, null), new Lazy <Thing>(() => this.person)); this.assembler.Cache.TryAdd(new CacheKey(this.domain.Iid, null), new Lazy <Thing>(() => this.domain)); this.assembler.Cache.TryAdd(new CacheKey(this.participant.Iid, null), new Lazy <Thing>(() => this.participant)); this.assembler.Cache.TryAdd(new CacheKey(this.catEd1.Iid, null), new Lazy <Thing>(() => this.catEd1)); this.assembler.Cache.TryAdd(new CacheKey(this.catEd2.Iid, null), new Lazy <Thing>(() => this.catEd2)); this.assembler.Cache.TryAdd(new CacheKey(this.catEd3.Iid, null), new Lazy <Thing>(() => this.catEd3)); this.assembler.Cache.TryAdd(new CacheKey(this.catEd4.Iid, null), new Lazy <Thing>(() => this.catEd4)); this.assembler.Cache.TryAdd(new CacheKey(this.catRel.Iid, null), new Lazy <Thing>(() => this.catRel)); this.assembler.Cache.TryAdd(new CacheKey(this.rule.Iid, null), new Lazy <Thing>(() => this.rule)); this.assembler.Cache.TryAdd(new CacheKey(this.model.Iid, null), new Lazy <Thing>(() => this.model)); this.assembler.Cache.TryAdd(new CacheKey(this.iteration.Iid, null), new Lazy <Thing>(() => this.iteration)); this.assembler.Cache.TryAdd(new CacheKey(this.elementDef11.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.elementDef11)); this.assembler.Cache.TryAdd(new CacheKey(this.elementDef12.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.elementDef12)); this.assembler.Cache.TryAdd(new CacheKey(this.elementDef21.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.elementDef21)); this.assembler.Cache.TryAdd(new CacheKey(this.elementDef22.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.elementDef22)); this.assembler.Cache.TryAdd(new CacheKey(this.elementDef31.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.elementDef31)); this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(true); this.permissionService.Setup(x => x.CanWrite(It.IsAny <ClassKind>(), It.IsAny <Thing>())).Returns(true); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); this.session.Setup(x => x.Assembler).Returns(this.assembler); this.session.Setup(x => x.ActivePerson).Returns(this.person); this.session.Setup(x => x.OpenIterations).Returns( new Dictionary <Iteration, Tuple <DomainOfExpertise, Participant> > { { this.iteration, new Tuple <DomainOfExpertise, Participant>(this.domain, this.participant) } }); this.settings = new RelationshipMatrixPluginSettings(); this.settings.PossibleClassKinds.Add(ClassKind.ElementDefinition); this.settings.PossibleClassKinds.Add(ClassKind.ElementUsage); this.pluginService.Setup(x => x.Read <RelationshipMatrixPluginSettings>()).Returns(this.settings); this.pluginService.Setup(x => x.Write(It.IsAny <RelationshipMatrixPluginSettings>())); }
/// <summary> /// Initializes a new instance of the <see cref="MatrixConfigurationViewModelBase"/> class /// </summary> /// <param name="session">The current <see cref="ISession"/></param> /// <param name="iteration">The current <see cref="Iteration"/></param> /// <param name="onUpdateAction">The action to perform on update</param> /// <param name="settings">The module settings</param> protected MatrixConfigurationViewModelBase(ISession session, Iteration iteration, Action onUpdateAction, RelationshipMatrixPluginSettings settings) { this.Iteration = iteration; this.OnUpdateAction = onUpdateAction; this.Session = session; this.PluginSetting = settings; var rdls = new List <ReferenceDataLibrary>(); var engineeringModelSetup = iteration.IterationSetup?.Container as EngineeringModelSetup; if (engineeringModelSetup == null) { logger.Error("The engineering-model setup is null."); } else { var mrdl = engineeringModelSetup.RequiredRdl.FirstOrDefault(); if (mrdl != null) { rdls.Add(mrdl); rdls.AddRange(mrdl.GetRequiredRdls()); } } this.ReferenceDataLibraries = rdls; this.Disposables = new List <IDisposable>(); }