/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> /// <param name="propertyProvider">The object providing properties to display</param> /// <param name="graphNode">The root node of the view model to generate.</param> private ObservableViewModel(IViewModelServiceProvider serviceProvider, IPropertiesProviderViewModel propertyProvider, IGraphNode graphNode) : this(serviceProvider) { if (graphNode == null) { throw new ArgumentNullException(nameof(graphNode)); } PropertiesProvider = propertyProvider; var node = ObservableViewModelService.ObservableNodeFactory(this, "Root", graphNode.Content.IsPrimitive, graphNode, new GraphNodePath(graphNode), graphNode.Content.Type, null); node.Initialize(); RootNode = node; node.CheckConsistency(); }
/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> /// <param name="nodeContainer">A <see cref="NodeContainer"/> to use to build view model nodes.</param> /// <param name="modelNode">The root model node of the view model to generate.</param> /// <param name="dirtiables">The list of <see cref="IDirtiable"/> objects linked to this view model.</param> public ObservableViewModel(IViewModelServiceProvider serviceProvider, NodeContainer nodeContainer, IGraphNode modelNode, IEnumerable <IDirtiable> dirtiables) : this(serviceProvider, nodeContainer, dirtiables.SafeArgument("dirtiables").ToList()) { if (modelNode == null) { throw new ArgumentNullException(nameof(modelNode)); } var node = ObservableViewModelService.ObservableNodeFactory(this, "Root", modelNode.Content.IsPrimitive, modelNode, new GraphNodePath(modelNode), modelNode.Content.Type, null); node.Initialize(); RootNode = node; node.CheckConsistency(); }
/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> /// <param name="modelContainer">A <see cref="ModelContainer"/> to use to build view model nodes.</param> /// <param name="modelNode">The root model node of the view model to generate.</param> /// <param name="dirtiables">The list of <see cref="IDirtiableViewModel"/> objects linked to this view model.</param> public ObservableViewModel(IViewModelServiceProvider serviceProvider, ModelContainer modelContainer, IModelNode modelNode, IEnumerable <IDirtiableViewModel> dirtiables) : this(serviceProvider, modelContainer, dirtiables.SafeArgument("dirtiables").ToList()) { if (modelNode == null) { throw new ArgumentNullException("modelNode"); } var node = observableViewModelService.ObservableNodeFactory(this, "Root", modelNode.Content.IsPrimitive, modelNode, new ModelNodePath(modelNode), modelNode.Content.Type, null); Identifier = new ObservableViewModelIdentifier(node.ModelGuid); node.Initialize(); RootNode = node; node.CheckConsistency(); }