Пример #1
0
 public void CopyProperties(BookInfo other)
 {
     this.ID = other.ID;
     this.Title = other.Title;
     this.Position = other.Position;
     this.Length = other.Length;
     this.Location = other.Location;
     this.LastReadTime = other.LastReadTime;
     this.ScrollProgress = other.ScrollProgress;
 }
Пример #2
0
		async void AddFilesToBookList(IReadOnlyList<StorageFile> files)
		{
			var folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("books", CreationCollisionOption.OpenIfExists);
			foreach (var file in files)
			{
				if (StorageFileHelper.FileExists(System.IO.Path.Combine("books", file.Name)))
				{
					continue;
				}
				var newFile = await file.CopyAsync(folder, file.Name, NameCollisionOption.ReplaceExisting);
				var size = (await newFile.GetBasicPropertiesAsync()).Size;
				var item = new BookInfo()
				{
					Title = newFile.DisplayName,
					Position = 0,
					Length = (int)size,
					Location = newFile.Path,
					LastReadTime = DateTime.Now,
				};
				ViewModel.AddBook(item);
			}
		}
Пример #3
0
        async void AddFilesToBookList(IReadOnlyList <StorageFile> files)
        {
            var folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("books", CreationCollisionOption.OpenIfExists);

            foreach (var file in files)
            {
                if (StorageFileHelper.FileExists(System.IO.Path.Combine("books", file.Name)))
                {
                    continue;
                }
                var newFile = await file.CopyAsync(folder, file.Name, NameCollisionOption.ReplaceExisting);

                var size = (await newFile.GetBasicPropertiesAsync()).Size;
                var item = new BookInfo()
                {
                    Title        = newFile.DisplayName,
                    Position     = 0,
                    Length       = (int)size,
                    Location     = newFile.Path,
                    LastReadTime = DateTime.Now,
                };
                ViewModel.AddBook(item);
            }
        }
Пример #4
0
 public FileCache(BookInfo book)
 {
     _bookInfo = book;
 }
Пример #5
0
 public void UpdateBook(BookInfo book)
 {
     DB.Update(book);
 }
Пример #6
0
 public void RemoveBook(BookInfo book)
 {
     DB.Delete(book);
     _booklist.Remove(book);
 }
Пример #7
0
 public void AddBook(BookInfo book)
 {
     DB.Insert(book);
     _booklist.Insert(0, book);
 }
Пример #8
0
        public FileCache(BookInfo book)
        {
			_bookInfo = book;
        }
Пример #9
0
 public BookManager(BookInfo book)
 {
     _book  = new Book();
     _cache = new FileCache(book);
     _cache.Init(BookCacheInited);
 }
Пример #10
0
 public void UpdateBook(BookInfo book)
 {
     DB.Update(book);
 }
Пример #11
0
 public void RemoveBook(BookInfo book)
 {
     DB.Delete(book);
     _booklist.Remove(book);
 }
Пример #12
0
 public void AddBook(BookInfo book)
 {
     DB.Insert(book);
     _booklist.Insert(0, book);
 }