Exemplo n.º 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;
 }
Exemplo n.º 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);
			}
		}
Exemplo n.º 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);
            }
        }
Exemplo n.º 4
0
 public FileCache(BookInfo book)
 {
     _bookInfo = book;
 }
Exemplo n.º 5
0
 public void UpdateBook(BookInfo book)
 {
     DB.Update(book);
 }
Exemplo n.º 6
0
 public void RemoveBook(BookInfo book)
 {
     DB.Delete(book);
     _booklist.Remove(book);
 }
Exemplo n.º 7
0
 public void AddBook(BookInfo book)
 {
     DB.Insert(book);
     _booklist.Insert(0, book);
 }
Exemplo n.º 8
0
        public FileCache(BookInfo book)
        {
			_bookInfo = book;
        }
Exemplo n.º 9
0
 public BookManager(BookInfo book)
 {
     _book  = new Book();
     _cache = new FileCache(book);
     _cache.Init(BookCacheInited);
 }
Exemplo n.º 10
0
 public void UpdateBook(BookInfo book)
 {
     DB.Update(book);
 }
Exemplo n.º 11
0
 public void RemoveBook(BookInfo book)
 {
     DB.Delete(book);
     _booklist.Remove(book);
 }
Exemplo n.º 12
0
 public void AddBook(BookInfo book)
 {
     DB.Insert(book);
     _booklist.Insert(0, book);
 }