Exemplo n.º 1
0
        public bool InsertScrapbookCategory(ScrapbookCategory category)
        {
            if (QueryScrapbookCategory(category.FolderName) != null)
            {
                return(false);
            }

            if (Insert(category) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <IReadOnlyList <FolderListItem> > GetItemList()
        {
            if (m_db == null)
            {
                m_db = new LocalDatabase();
            }

            List <FolderListItem> itemList = new List <FolderListItem>();
            Size thumSize = await FolderListItem.GetThumSizeFromWindow();

            int fontSize = FolderListItem.GetFontSizeFromThumImage((int)thumSize.Width);
            ScrapbookCategory category = m_db.QueryScrapbookCategory(m_folderName);
            StorageFolder     folder   = await EnvPath.GetScrapbookSubFolder(category.FolderName);

            foreach (ScrapbookItem scrapItem in m_db.QueryScrapbookItemList(category))
            {
                string filePath = Path.Combine(folder.Path, scrapItem.FileName);
                try
                {
                    StorageFile storage = await StorageFile.GetFileFromPathAsync(filePath);

                    itemList.Add(new FolderListItem()
                    {
                        Name       = scrapItem.FileName,
                        Path       = filePath,
                        Token      = "",
                        Type       = FolderListItem.GetFileTypeFromStorage((StorageFile)storage),
                        ThumWidth  = (int)thumSize.Width,
                        ThumHeight = (int)thumSize.Height,
                        TextSize   = fontSize,
                    });
                }
                catch (Exception e)
                {
                    Debug.WriteLine("ScrapbookItemNavigateParameter error=" + e.ToString() + " filePath=" + filePath);
                }
            }

            return(itemList);
        }
Exemplo n.º 3
0
 public IEnumerable <ScrapbookItem> QueryScrapbookItemList(ScrapbookCategory category)
 {
     return(Table <ScrapbookItem>().Where(x => x.ScrapbookCategoryId == category.Id));
 }