void updatePreset() { PresetMetadata preset = new PresetMetadata(); preset.Id = selectedPreset.Id; preset.Name = Name; preset.Rating = Rating; preset.IsRatingEnabled = RatingEnabled; preset.Title = Title; preset.IsTitleEnabled = TitleEnabled; preset.Author = Author; preset.IsAuthorEnabled = AuthorEnabled; preset.Description = Description; preset.IsDescriptionEnabled = DescriptionEnabled; preset.Copyright = Copyright; preset.IsCopyrightEnabled = CopyrightEnabled; preset.CreationDate = Creation; preset.IsCreationDateEnabled = CreationEnabled; using (PresetMetadataDbCommands presetMetaDataCommands = new PresetMetadataDbCommands()) { try { PresetMetadata result = presetMetaDataCommands.update(preset); MetadataPresets.Remove(SelectedPreset); CollectionsSort.insertIntoSortedCollection<PresetMetadata>(MetadataPresets, result); clear(); } catch (Exception e) { Logger.Log.Error("Error updating presetMetadata", e); } } }
void loadMetaDataPresets() { MetaDataPresets.Clear(); MetaDataPresets.Add(noPresetMetaData); using (PresetMetadataDbCommands db = new PresetMetadataDbCommands()) { foreach (PresetMetadata data in db.getAllPresets()) { MetaDataPresets.Add(data); } } SelectedMetaDataPreset = noPresetMetaData; }