示例#1
0
        public AssetEdit(ContentFile contentFile)
        {
            this.contentFile = contentFile;

            Path = ResolvePath();

            var asset = contentFile.Asset;
            if (asset != null)
            {
                Name = asset.Name;
                BuildAction = asset.BuildAction;
                Importer = asset.Importer;
                Processor = asset.Processor;
            }
            else
            {
                Name = System.IO.Path.GetFileNameWithoutExtension(contentFile.File.Name);
                BuildAction = AssetBuildActionKind.Compile;
            }

            // TODO
            // IImporterInfo でなんとか処理したい。表示名を使用したいから。
            Importers = Workspace.Current.Project.ImporterInfoRegistry.EnumerateImporterNames().OrderBy(i => i);
            Processors = Workspace.Current.Project.ProcessorInfoRegistry.EnumerateProcessorNames().OrderBy(i => i);
        }
        public ContentFileViewModel(ContentFile model, ContentFolderViewModel parent, IMessenger messenger)
            : base(messenger)
        {
            this.model = model;
            Parent = parent;
            IsAsset = (model.Asset != null);

            EditCommand = new RelayCommand(Edit);
            ViewCommand = new RelayCommand(View, () => IsAsset);
            DeleteCommand = new RelayCommand(Delete);
            RegisterAsAssetCommand = new RelayCommand(RegisterAsAsset, () => !IsAsset);
            EditAssetCommand = new RelayCommand(EditAsset, () => IsAsset);
            UnregisterAsAssetCommand = new RelayCommand(UnregisterAsAsset, () => IsAsset);
        }