예제 #1
0
        internal void addFileToDatabase(TaggedFile pFileToBeAddedToDatabase)
        {
            //LoadJsonDatabaseFile();

            mTaggedFileListe.Add(pFileToBeAddedToDatabase);

            writeTaggedListToFile();
        }
예제 #2
0
        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>();
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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();
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
 /// <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));
 }