private void GetFilesAndCollectionsInCurrentDirectory()
        {
            currentDirectoryDirectories.Clear();
            string[] directories = Directory.GetDirectories(Path.Combine(rootPath, currentDirectory));
            foreach (string directoryName in directories)
            {
                if (keywordFilter.Trim() == string.Empty ||
                    Path.GetFileNameWithoutExtension(directoryName).Contains(keywordFilter))
                {
                    string subPath = directoryName.Substring(rootPath.Length + 1);
                    currentDirectoryDirectories.Add(subPath);
                }
            }

            currentDirectoryFiles.Clear();
            string[] files = Directory.GetFiles(Path.Combine(rootPath, currentDirectory));
            foreach (string filename in files)
            {
                if (ApplicationSettings.LibraryFilterFileExtensions.Contains(Path.GetExtension(filename).ToLower()))
                {
                    if (keywordFilter.Trim() == string.Empty ||
                        Path.GetFileNameWithoutExtension(filename).Contains(keywordFilter))
                    {
                        currentDirectoryFiles.Add(filename);
                    }
                }
            }

            LibraryProvider.OnDataReloaded(null);
        }
示例#2
0
        public void LoadLibraryItems()
        {
            printItems.Clear();
            IEnumerable <PrintItem> partFiles = GetLibraryItems(KeywordFilter);

            if (partFiles != null)
            {
                foreach (PrintItem part in partFiles)
                {
                    PrintItemWrapper item = new PrintItemWrapper(part);
                    SetProviderLocator(item);
                    printItems.Add(item);
                }
            }

            childCollections.Clear();
            GetChildCollections();
            IEnumerable <PrintItemCollection> collections = GetChildCollections();

            if (collections != null)
            {
                childCollections.AddRange(collections);
            }

            LibraryProvider.OnDataReloaded(null);
        }
示例#3
0
        public override async void AddFilesToLibrary(IList <string> files, ReportProgressRatio reportProgress = null)
        {
            if (files != null && files.Count > 0)
            {
                // create enough info to show that we have items pending (maybe use names from this file list for them)
                // refresh the display to show the pending items
                //LibraryProvider.OnDataReloaded(null);

                await Task.Run(() => loadFilesIntoLibraryBackgoundWorker_DoWork(files));

                if (baseLibraryCollection != null)
                {
                    LoadLibraryItems();
                    LibraryProvider.OnDataReloaded(null);
                }
            }
        }
示例#4
0
        public override void RemoveItem(PrintItemWrapper printItemWrapper)
        {
            int index = printItems.IndexOf(printItemWrapper);

            if (index < 0)
            {
                // It may be possible to have the same item in the remove list twice.
                // so if it is not in the PrintItems then ignore it.
                return;
            }
            printItems.RemoveAt(index);

            // and remove it from the data base
            printItemWrapper.Delete();

            LoadLibraryItems();
            LibraryProvider.OnDataReloaded(null);
        }
示例#5
0
 public override void RemoveCollection(PrintItemCollection collectionToRemove)
 {
     collectionToRemove.Delete();
     LoadLibraryItems();
     LibraryProvider.OnDataReloaded(null);
 }
示例#6
0
 public override void AddItem(PrintItemWrapper itemToAdd)
 {
     throw new NotImplementedException();
     LibraryProvider.OnDataReloaded(null);
 }