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; }
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); } }
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); } }
public FileCache(BookInfo book) { _bookInfo = book; }
public void UpdateBook(BookInfo book) { DB.Update(book); }
public void RemoveBook(BookInfo book) { DB.Delete(book); _booklist.Remove(book); }
public void AddBook(BookInfo book) { DB.Insert(book); _booklist.Insert(0, book); }
public BookManager(BookInfo book) { _book = new Book(); _cache = new FileCache(book); _cache.Init(BookCacheInited); }