protected AssetCompositeHierarchyViewModel([NotNull] AssetViewModelConstructionParameters parameters) : base(parameters) { Asset.Hierarchy.Parts.Values.ForEach(TrackBaseChanges); var parts = NodeContainer.GetNode(Asset.Hierarchy.Parts); parts.ItemChanged += PartsChanged; Session.DeletedAssetsChanged += AssetsDeleted; }
private AssetViewModel CreateAsset(DirectoryBaseViewModel directory, AssetItem assetItem, bool canUndoRedoCreation, LoggerResult loggerResult, bool isLoading) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } if (assetItem == null) { throw new ArgumentNullException(nameof(assetItem)); } AssetCollectionItemIdHelper.GenerateMissingItemIds(assetItem.Asset); var parameters = new AssetViewModelConstructionParameters(ServiceProvider, directory, Package, assetItem, directory.Session.AssetNodeContainer, canUndoRedoCreation); Session.GraphContainer.InitializeAsset(assetItem, loggerResult); var assetType = assetItem.Asset.GetType(); var assetViewModelType = typeof(AssetViewModel <>); while (assetType != null) { if (Session.AssetViewModelTypes.TryGetValue(assetType, out assetViewModelType)) { break; } assetViewModelType = typeof(AssetViewModel <>); assetType = assetType.BaseType; } if (assetViewModelType.IsGenericType) { assetViewModelType = assetViewModelType.MakeGenericType(assetItem.Asset.GetType()); } var asset = (AssetViewModel)Activator.CreateInstance(assetViewModelType, parameters); if (!isLoading) { asset.Initialize(); } return(asset); }
/// <summary> /// Initializes a new instance of the <see cref="AssetViewModel{TAsset}"/> class. /// </summary> /// <param name="parameters">The constructor parameter for this asset view model.</param> public AssetViewModel([NotNull] AssetViewModelConstructionParameters parameters) : base(parameters) { }
protected AssetCompositeViewModel([NotNull] AssetViewModelConstructionParameters parameters) : base(parameters) { }
public ImportedAssetViewModel(AssetViewModelConstructionParameters parameters) : base(parameters) { }