コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: AssetViewModel.cs プロジェクト: vvvv/stride
 /// <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)
 {
 }
コード例 #4
0
 protected AssetCompositeViewModel([NotNull] AssetViewModelConstructionParameters parameters) : base(parameters)
 {
 }
コード例 #5
0
 public ImportedAssetViewModel(AssetViewModelConstructionParameters parameters) : base(parameters)
 {
 }