public static PhoneStorage GetPhoneStorageInstance() { if (_instance == null) { if (_db == null) _db = new SmartReaderDataContext(SmartReaderDataContext.DBConnectionString); _instance = new PhoneStorage(_db); } return _instance; }
private void ClearDB(object sender, RoutedEventArgs e) { using (var db1 = new SmartReaderDataContext("isostore:/SmartReader.sdf")) { if (db1.DatabaseExists() == false) { db1.DeleteDatabase(); db1.CreateDatabase(); } } }
private void Init() { EncodingHelper.BuildGBKToUnicodeMapping(); ImageTools.IO.Decoders.AddDecoder<GifDecoder>(); Settings.Load(); using (var db1 = new SmartReaderDataContext("isostore:/SmartReader.sdf")) { if (db1.DatabaseExists() == false) { db1.CreateDatabase(); } } }
public void PrepareTempDB() { using (var db1 = new SmartReaderDataContext("isostore:/SmartReader.sdf")) { if (db1.DatabaseExists() == false) { db1.CreateDatabase(); } } Storage = PhoneStorage.GetPhoneStorageInstance(); WebSite website = CreateFakeWebSite(); Book book = CreateFakeBook(website); Chapter chapter = CreateFakeChapter(book); CreateFakeArticleImage(chapter); }
public void PrepareTempDB() { using (var db1 = new SmartReaderDataContext("isostore:/SmartReader.sdf")) { if (db1.DatabaseExists() == false) { db1.CreateDatabase(); } } Storage = PhoneStorage.GetPhoneStorageInstance(); TestWebSite = GetFakeWebSite(); TestBook = GetFakeBook(TestWebSite); TestTextChapter = GetFakeTextChapter(TestBook); TestImageChapter = GetFakeImageChapter(TestBook); TestBook.Chapters = new[]{ TestTextChapter, TestImageChapter}; Storage.SaveWebSite(TestWebSite); Storage.SaveBook(TestBook); Storage.SaveChapters(TestBook.Chapters); //CreateFakeArticleImage(chapter); }
private PhoneStorage(SmartReaderDataContext db) { _db = db; }