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);
                }
            }
        }
        public MetaDataPresetsViewModel()
        {
            Tags = new ObservableCollection <string>();

            using (PresetMetadataDbCommands presetMetadataCommands = new PresetMetadataDbCommands())
            {
                MetadataPresets = new ObservableCollection <PresetMetadata>(presetMetadataCommands.getAllPresets());
            }

            CreatePresetCommand = new Command(new Action(createPreset));
            CreatePresetCommand.IsExecutable = false;

            UpdatePresetCommand = new Command(new Action(updatePreset));
            UpdatePresetCommand.IsExecutable = false;

            DeletePresetCommand = new Command(new Action(deletePreset));
            DeletePresetCommand.IsExecutable = false;

            ClearPresetCommand = new Command(new Action(() =>
            {
                clear();
            }));

            clear();
        }
        public MetaDataPresetsViewModel()
        {
            Tags = new ObservableCollection<string>();
                        
            using (PresetMetadataDbCommands presetMetadataCommands = new PresetMetadataDbCommands())
            {
                MetadataPresets = new ObservableCollection<PresetMetadata>(presetMetadataCommands.getAllPresets());                                
            }

            CreatePresetCommand = new Command(new Action(createPreset));          
            CreatePresetCommand.IsExecutable = false;

            UpdatePresetCommand = new Command(new Action(updatePreset));        
            UpdatePresetCommand.IsExecutable = false;

            DeletePresetCommand = new Command(new Action(deletePreset));
            DeletePresetCommand.IsExecutable = false;
            
            ClearPresetCommand = new Command(new Action(() =>
                {
                    clear();
                }));

            clear();
        }
Пример #4
0
        void loadMetaDataPresets()
        {
            MetaDataPresets.Clear();

            MetaDataPresets.Add(noPresetMetaData);

            using (PresetMetadataDbCommands db = new PresetMetadataDbCommands())
            {
                foreach (PresetMetadata data in db.getAllPresets())
                {
                    MetaDataPresets.Add(data);
                }
            }
            SelectedMetaDataPreset = noPresetMetaData;
        }
 void deletePreset()
 {
     using (PresetMetadataDbCommands presetMetaDataCommands = new PresetMetadataDbCommands())
     {
         try
         {
             presetMetaDataCommands.delete(SelectedPreset);
             MetadataPresets.Remove(SelectedPreset);
             clear();
         }
         catch (Exception e)
         {
             Logger.Log.Error("Error deleting presetMetadata", e);
         }
     }
 }
        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 deletePreset()
        {
            using (PresetMetadataDbCommands presetMetaDataCommands = new PresetMetadataDbCommands())
            {

                try
                {
                     presetMetaDataCommands.delete(SelectedPreset);
                     MetadataPresets.Remove(SelectedPreset);
                     clear();
                   
                }
                catch (Exception e)
                {
                    Logger.Log.Error("Error deleting presetMetadata", e);
                }
            }
        }
Пример #8
0
        void loadMetaDataPresets()
        {           
            MetaDataPresets.Clear();

            MetaDataPresets.Add(noPresetMetaData);

            using (PresetMetadataDbCommands db = new PresetMetadataDbCommands())
            {
                foreach (PresetMetadata data in db.getAllPresets())
                {
                    MetaDataPresets.Add(data);
                }

            }
            SelectedMetaDataPreset = noPresetMetaData;
        }