public FilesViewModel(PackageReader reader) { _filesCollection = new ObservableCollection<FilesItemViewModel>(); foreach (string parameter in reader.ReadParameters("files")) { ObservableCollection<ItemViewModel> includeCollection = new ObservableCollection<ItemViewModel>(reader.GetRulesSourceValuesByParameterForEditableCollections("files", parameter, "include")); FilesItemViewModel model = new FilesItemViewModel() { FilesRoot = reader.GetFilesRulesPropertyValueByParameterAndName(parameter, "root"), TrimPath = reader.GetFilesRulesPropertyValueByParameterAndName(parameter, "trim-path"), EditCollectionViewModel = new EditCollectionViewModel(reader, includeCollection), Name = parameter, }; _filesCollection.Add(model); } SourceString = reader.GetRulesSourceStringPropertyValueByName("files"); _filesCollection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(FilesCollectionCollectionChanged); }
private void CreateModels(PackageReader reader) { string package = "package"; _packageViewModel = new PackageViewModel() { Name = reader.GetRulesPropertyValueByName(package, "name"), DisplayName = reader.GetRulesPropertyValueByName(package, "display-name"), Architecture = reader.GetRulesPropertyValueByName(package, "arch"), Feed = reader.GetRulesPropertyValueByName(package, "feed"), Location = reader.GetRulesPropertyValueByName(package, "location"), Publisher = reader.GetRulesPropertyValueByName(package, "publisher"), Version = reader.GetRulesPropertyValueByName(package, "version") }; string metadata = "metadata"; _metadataViewModel = new MetadataViewModel() { Summary = reader.GetRulesPropertyValueByName(metadata, "summary"), Description = reader.GetRulesPropertyValueByName(metadata, "description"), AuthorVersion = reader.GetRulesPropertyValueByName(metadata, "author-version"), BugTracker = reader.GetRulesPropertyValueByName(metadata, "bug-tracker"), Stability = reader.GetRulesPropertyValueByName(metadata, "stability"), Licenses = reader.GetRulesPropertyValueByName(metadata, "licenses"), }; //_requiresViewModel = new RequiresViewModel() //{ // RequiredPackages = new ObservableCollection<Package>() //}; _packageCompositionViewModel = new PackageCompositionViewModel() { Symlinks = reader.GetRulesPropertyValueByName("package-composition", "symlinks") }; _packageCompositionViewModel = new PackageCompositionViewModel() { Symlinks = reader.GetRulesPropertyValueByName("package-composition", "symlinks") }; _filesCollection = new ObservableCollection<FilesViewModel>(); foreach (string parameter in reader.ReadFilesParameters()) { ObservableCollection<string> collection = new ObservableCollection<string>(reader.GetFilesIncludeList(parameter)); FilesViewModel model = new FilesViewModel(parameter) { Root = reader.GetFilesRulesPropertyValueByParameterAndName(parameter,"root"), TrimPath = reader.GetFilesRulesPropertyValueByParameterAndName(parameter, "trim-path"), Include = collection }; _filesCollection.Add(model); } }