예제 #1
0
 public static PhoneStorage GetPhoneStorageInstance()
 {
     if (_instance == null)
     {
         if (_db == null)
             _db = new SmartReaderDataContext(SmartReaderDataContext.DBConnectionString);
         _instance = new PhoneStorage(_db);
     }
     return _instance;
 }
예제 #2
0
 private void ClearDB(object sender, RoutedEventArgs e)
 {
     using (var db1 = new SmartReaderDataContext("isostore:/SmartReader.sdf"))
     {
         if (db1.DatabaseExists() == false)
         {
             db1.DeleteDatabase();
             db1.CreateDatabase();
         }
     }
 }
예제 #3
0
 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();
         }
     }
 }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 private PhoneStorage(SmartReaderDataContext db)
 {
     _db = db;
 }