Exemplo n.º 1
0
        /// <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)
        {
            if (modelNode == null)
            {
                throw new ArgumentNullException("modelNode");
            }
            var node = ObservableModelNode.Create(this, "Root", modelNode.Content.IsPrimitive, null, modelNode, modelNode.Content.Type, null);

            Identifier = new ObservableViewModelIdentifier(node.ModelGuid);
            dirtiableViewModels.Add(node, dirtiables.ToList());
            node.Initialize();
            RootNode = node;
            node.CheckConsistency();
        }
Exemplo n.º 2
0
 private static ObservableModelNode DefaultCreateNode(ObservableViewModel viewModel, string baseName, bool isPrimitive, IGraphNode modelNode, GraphNodePath graphNodePath, Type contentType, object index)
 {
     return(ObservableModelNode.Create(viewModel, baseName, isPrimitive, modelNode, graphNodePath, contentType, index));
 }
Exemplo n.º 3
0
 internal IReadOnlyCollection <IDirtiableViewModel> GetDirtiableViewModels(ObservableModelNode node)
 {
     return(dirtiableViewModels[(ObservableModelNode)node.Root]);
 }