Exemple #1
0
        private void InitStorage()
        {
            if (!StorageFileHelper.FolderExists("books"))
            {
                StorageFileHelper.CreateFolder("books");
            }

            using (var db = new DataBase.DataBase())
            {
                if (!db.DatabaseExists())
                {
                    try
                    {
                        db.CreateDatabase();
                    }
                    catch
                    {
                        db.Dispose();
                        if (StorageFileHelper.FileExists("DB.sdf"))
                        {
                            StorageFileHelper.DeleteFile("DB.sdf");
                        }
                    }
                }
            }
        }
        public BookListViewModel()
        {
            DB = new DataBase.DataBase();

            var items = from item in DB.Books select item;
            _booklist = new ObservableCollection<BookInfo>(items);
        }
Exemple #3
0
        public BookListViewModel()
        {
            DB = new DataBase.DataBase();

            var items = from item in DB.Books select item;

            _booklist = new ObservableCollection <BookInfo>(items);
        }
Exemple #4
0
        private void InitStorage()
        {
            if (!StorageFileHelper.FolderExists("books"))
            {
                StorageFileHelper.CreateFolder("books");
            }

            using (var db = new DataBase.DataBase())
            {
                if (!db.DatabaseExists())
                {
                    try
                    {
                        db.CreateDatabase();
                    }
                    catch
                    {
                        db.Dispose();
                        if (StorageFileHelper.FileExists("DB.sdf"))
                        {
                            StorageFileHelper.DeleteFile("DB.sdf");
                        }
                    }
                }
            }
        }