Inheritance: PackageExplorerViewModel.ViewModelBase
Exemple #1
0
        private PackageFile(IPackageFile file, string name, PackageFolder parent, PackageViewModel viewModel)
            : base(name, parent, viewModel)
        {
            if (file == null) {
                throw new ArgumentNullException("file");
            }

            _file = file;
        }
        public PackageMetadataFile(string name, string filePath, PackageViewModel packageViewModel)
        {
            Debug.Assert(name != null);
            Debug.Assert(filePath != null);
            Debug.Assert(packageViewModel != null);

            _filePath = filePath;
            _name = name;
            _packageViewModel = packageViewModel;
        }
        internal FileEditorViewModel(PackageViewModel packageViewModel, IEditablePackageFile fileInEdit)
        {
            Debug.Assert(packageViewModel != null);
            Debug.Assert(fileInEdit != null);

            _packageViewModel = packageViewModel;
            _fileInEdit = fileInEdit;

            // Note: has to preserve the file name here so that the new file "appears" to be the same as old file
            _filePath = fileInEdit.OriginalPath ?? Path.Combine(FileHelper.GetTempFilePath(), fileInEdit.Name);

            _closeCommand = new RelayCommand<IFileEditorService>(CloseExecute);
            _saveCommand = new RelayCommand<IFileEditorService>(SaveExecute);
        }
        public static PackageFolder Convert(List<IPackageFile> paths, PackageViewModel viewModel)
        {
            if (paths == null) {
                throw new ArgumentNullException("paths");
            }

            paths.Sort((p1, p2) => String.Compare(p1.Path, p2.Path, StringComparison.OrdinalIgnoreCase));

            PackageFolder root = new PackageFolder("", viewModel);

            List<Tuple<IPackageFile, string[]>> parsedPaths = paths.Select(p => Tuple.Create(p, p.Path.Split('\\'))).ToList();
            Parse(root, parsedPaths, 0, 0, parsedPaths.Count);

            return root;
        }
        private PackageFile(IPackageFile file, string name, PackageFolder parent, PackageViewModel viewModel)
            : base(name, parent, viewModel)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            _file = file;

            var physicalFile = file as PhysicalPackageFile;
            if (physicalFile != null)
            {
                WatchPhysicalFile(physicalFile);
            }
            ReplaceCommand = new RelayCommand(Replace, () => !viewModel.IsInEditFileMode);
        }
 public PackageFolder(string name, PackageViewModel viewModel)
     : base(name, null, viewModel)
 {
     Children = new SortedCollection<PackagePart>();
 }
Exemple #7
0
 public PackageFile(IPackageFile file, string name, PackageViewModel viewModel)
     : this(file, name, null, viewModel)
 {
 }
 public SavePackageCommand(PackageViewModel model)
     : base(model)
 {
 }
 public ViewContentCommand(PackageViewModel packageViewModel)
     : base(packageViewModel)
 {
 }