internal void addFileToDatabase(TaggedFile pFileToBeAddedToDatabase) { //LoadJsonDatabaseFile(); mTaggedFileListe.Add(pFileToBeAddedToDatabase); writeTaggedListToFile(); }
private bool localSavingState; //true > All changes saved /// <summary> /// Constructor /// </summary> public guiDataViewModel() { localSavingState = true; localGuiDataSet = new TaggedFile(); localGuiDataSet.Tags = new List <string>(); localGuiRemoveTagControls = new ObservableCollection <guiRemoveTagControls>(); localGuiSearchResults = new ObservableCollection <TaggedFile>(); }
internal bool removeFileFromDB(TaggedFile pFileToBeRemoved) { int indexOfFileToBeRemoved = mTaggedFileListe.FindIndex(m => m.Path == pFileToBeRemoved.Path); if (indexOfFileToBeRemoved != -1) { mTaggedFileListe.RemoveAt(indexOfFileToBeRemoved); writeTaggedListToFile(); return(true); } else { return(false); } }
internal void addTagsToFileInDatabase(TaggedFile pFileWithTagsToBeAddedToExistingFileInDatabase) { //LoadJsonDatabaseFile(); int indexOfFileToManipulate = mTaggedFileListe.FindIndex(m => m.Path == pFileWithTagsToBeAddedToExistingFileInDatabase.Path); mTaggedFileListe[indexOfFileToManipulate].Tags.Clear(); foreach (var item in pFileWithTagsToBeAddedToExistingFileInDatabase.Tags) { mTaggedFileListe[indexOfFileToManipulate].Tags.Add(item); } writeTaggedListToFile(); }
/// <summary> /// Write Tags and IdentNr from Database to local File for Gui /// true > File found and inform. copied /// false > File not found /// </summary> internal bool getTagsAndIdentNrFromFileInDatabase(TaggedFile pLocalObjectToStoreTagsAndIdentNr) { int indexOfFileToReadFrom = mTaggedFileListe.FindIndex(m => m.Path == pLocalObjectToStoreTagsAndIdentNr.Path); if (indexOfFileToReadFrom != -1) { foreach (var item in mTaggedFileListe[indexOfFileToReadFrom].Tags) { pLocalObjectToStoreTagsAndIdentNr.Tags.Add(item); } pLocalObjectToStoreTagsAndIdentNr.IdentNr = mTaggedFileListe[indexOfFileToReadFrom].IdentNr; return(true); } return(false); }
/// <summary> /// Check if TaggedFile is already in database /// Return: true > file is already in database /// false > file is NOT in database /// </summary> public bool doesFileExistDatabase(TaggedFile pFileWithTagsToBeSavedInDatabase) { //var item = mTaggedFileListe.FirstOrDefault(m => m.Path == pFileWithTagsToBeSavedInDatabase.Path); return(mTaggedFileListe.Exists(m => m.Path == pFileWithTagsToBeSavedInDatabase.Path)); }