Beispiel #1
0
        public MainPage()
        {
            this.InitializeComponent();
            AdControl.ApplicationId  = "9nc4zpfn97sc";//广告
            AdControl.AdUnitId       = "1100039452";
            AdControl.ErrorOccurred += (s, e) =>
            {
                Adstaus.Text = e.ErrorMessage;
            };

            Window.Current.SetTitleBar(TitleTextBlock);//设置标题栏为TitleTextBlock
            BackButton.Visibility = Visibility.Collapsed;
            MyFrame.Navigate(typeof(IndexPage));
            TitleTextBlock.Text = "4K专区";
            Four_k.IsSelected   = true;
            dbname = "MyDB.db";//数据库名
            string          fdlocal    = ApplicationData.Current.LocalFolder.Path;
            string          filename   = dbname;
            string          dbfullpath = Path.Combine(fdlocal, filename);
            ISQLitePlatform platform   = new SQLitePlatformWinRT();
            // 连接对象
            SQLiteConnection conn = new SQLiteConnection(platform, dbfullpath);

            WriteLine("db pathe: " + conn.DatabasePath);
            // 创建表
            int rn = conn.CreateTable <UserItem>(CreateFlags.None);

            WriteLine("create table res = {0}", rn);
            conn.Dispose();
        }
Beispiel #2
0
        public SQLiteConnection imDbconnection(string dbPath, string dbName)
        {
            var             path     = Path.Combine(dbPath, dbName);
            ISQLitePlatform platform = new SQLitePlatformWinRT();

            return(new SQLiteConnection(platform, path));
        }
Beispiel #3
0
        public SQLiteConnection GetConnection()
        {
            const string sqliteFilename = "ScoreTracker.db3";
            var          path           = Path.Combine(ApplicationData.Current.LocalFolder.Path, sqliteFilename);
            var          platform       = new SQLitePlatformWinRT();

            return(new SQLiteConnection(platform, path));
        }
Beispiel #4
0
        public SQLiteConnection DbConnection()
        {
            var             dbName   = "CustomersDb.db3";
            var             path     = Path.Combine(ApplicationData.Current.LocalFolder.Path, dbName);
            ISQLitePlatform platform = new SQLitePlatformWinRT();

            return(new SQLiteConnection(platform, path));
        }
        public SQLiteConnection GetConnection()
        {
            var path       = System.IO.Path.Combine(ApplicationData.Current.LocalFolder.Path, App2.App.dbName);
            var Platform   = new  SQLitePlatformWinRT();
            var connection = new SQLiteConnection(Platform, path);

            return(connection);
        }
        public SQLiteConnection DbConnection()
        {
            var    dbName   = "FDLiz.db3";
            string path     = Path.Combine(ApplicationData.Current.LocalFolder.Path, dbName);
            var    platform = new SQLitePlatformWinRT();

            return(new SQLiteConnection(platform, path));
        }
Beispiel #7
0
        public SQLiteConnection DbConnection()
        {
            var    dbName   = "EzraDatabase.db3";
            string path     = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, dbName);
            var    platform = new SQLitePlatformWinRT();

            return(new SQLiteConnection(platform, path));
        }
        public SQLiteConnection GetConnection()
        {
            var filename   = "Student.db";
            var path       = Path.Combine(ApplicationData.Current.LocalFolder.Path, filename);
            var platform   = new SQLitePlatformWinRT();
            var connection = new SQLiteConnection(platform, path);

            return(connection);
        }
Beispiel #9
0
        public SQLiteConnection GetConnection()
        {
            //download SQLite for Universal Windows Platform from http://www.sqlite.org/download.html
            //add it and Visual C++ 2013 Runtime Package for Windows as references (Universal Windows > Extensions)
            SQLitePlatformWinRT platform = new SQLitePlatformWinRT();
            string sqliteFilename        = Configuration.DBname + ".db3";
            string path = Path.Combine(ApplicationData.Current.LocalFolder.Path, sqliteFilename);

            return(new SQLiteConnection(platform, path));
        }
Beispiel #10
0
        public SQLiteConnection GetConnection()
        {
            string dbPath = ApplicationData.Current.LocalFolder.Path;

            var path     = System.IO.Path.Combine(dbPath, GlobalDegisken.localDbName);
            var platform = new SQLitePlatformWinRT();

            var connection = new SQLiteConnection(platform, path);

            return(connection);
        }
Beispiel #11
0
        public void DbConnect()
        {
            string fdlocal  = ApplicationData.Current.LocalFolder.Path;
            string filename = "Music.db";
            string strConn  = Path.Combine(fdlocal, filename);

            ISQLitePlatform platform = new SQLitePlatformWinRT();

            _conn = new SQLiteConnection(platform, strConn);
            var dbExist = IsExistDb(filename);
        }
Beispiel #12
0
        public SQLiteAsyncConnection GetConnection()
        {
            var    sqliteFilename = "AAAAAAAAA.db3";
            string documentsPath  = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
            var    path           = Path.Combine(documentsPath, sqliteFilename);
            var    platform       = new SQLitePlatformWinRT();
            var    param          = new SQLiteConnectionString(path, false);
            var    connection     = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, param));

            return(connection);
        }
Beispiel #13
0
        public DataService()
        {
            var sqlitePlatform         = new SQLitePlatformWinRT();
            var connectionString       = Path.Combine(ApplicationData.Current.LocalFolder.Path, FileName);
            var sqliteConnectionString = new SQLiteConnectionString(connectionString, false);

            baseConnection = new SQLiteConnectionWithLock(sqlitePlatform, sqliteConnectionString);
            connection     = new SQLiteAsyncConnection(() => baseConnection);

            EnsureTableExists <FolderData>();
            EnsureTableExists <NoteData>();
        }
Beispiel #14
0
        /// <summary>
        /// 获取SQL链接
        /// </summary>
        /// <returns>SQL链接</returns>
        public SQLiteConnection GetSqLiteConnection()
        {
            ISQLitePlatform  platform = new SQLitePlatformWinRT();
            SQLiteConnection con      = new SQLiteConnection(platform, DbFilePath);

            /*
             * if (connection != null)
             *  return connection;
             * else return connection = new SQLiteConnection(platform, DbFilePath);
             */



            return(con);
        }
        //首次使用本软件,创建数据表
        public bool createTables(string tablePath)
        {
            string localPath  = ApplicationData.Current.LocalFolder.Path;
            string dbfullpath = Path.Combine(localPath, DB_NAME);

            ISQLitePlatform platform = new SQLitePlatformWinRT();
            // 连接对象
            SQLiteConnection conn = new SQLiteConnection(platform, dbfullpath);

            // 创建表
            int rnSetting = conn.CreateTable <TaxSetting>(CreateFlags.None);
            int rnDetail  = conn.CreateTable <TaxDetail>(CreateFlags.None);

            conn.Dispose();
            return(rnSetting == 0 && rnDetail == 0);
        }
Beispiel #16
0
        public SQLiteAsyncConnection GetConnection()
        {
            var sqliteFilename = AppSettings.SQLiteDatabaseName;
            var localPath      = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
            var path           = Path.Combine(localPath, sqliteFilename);

            var platform = new SQLitePlatformWinRT();

            var connectionWithLock = new SQLiteConnectionWithLock(
                platform,
                new SQLiteConnectionString(path, true));

            var connection = new SQLiteAsyncConnection(() => connectionWithLock);

            return(connection);
        }
Beispiel #17
0
        public static bool DatabaseConnect()
        {
            try
            {
                SQLitePlatformWinRT Platform = new SQLitePlatformWinRT();
                string DatabasePath          = Path.Combine(ApplicationData.Current.LocalFolder.Path, "Database.sqlite");
                SQLConnectionLock = new SQLiteConnectionWithLock(Platform, new SQLiteConnectionString(DatabasePath, false));
                SQLConnection     = new SQLiteAsyncConnection(() => SQLConnectionLock);
                //connectionFactory.BusyTimeout = new TimeSpan(0, 0, 0, 1);

                Debug.WriteLine("Successfully connected to the database.");
                return(true);
            }
            catch
            {
                Debug.WriteLine("Failed to connect to the database.");
                return(false);
            }
        }
        public async Task <ConnectionInfo <SQLiteAsyncConnection> > GetConnection()
        {
            ConnectionInfo <SQLiteAsyncConnection> connectionInfo = new ConnectionInfo <SQLiteAsyncConnection>();

            connectionInfo.IsInitializedDbStructure = true;

            var    sqliteFilename = XamarinSocialApp.UI.Common.Implementations.Constants.Constants.Configuration.csLocalDbFileName;
            string path           = Path.Combine(ApplicationData.Current.LocalFolder.Path, sqliteFilename);

            if (!await FileExists(path))
            {
                connectionInfo.IsInitializedDbStructure = false;
            }

            var plat = new SQLitePlatformWinRT();
            var connectionFactory = new Func <SQLiteConnectionWithLock>(() =>
                                                                        new SQLiteConnectionWithLock(plat, new SQLiteConnectionString(path, storeDateTimeAsTicks: false)));
            var asyncConnection = new SQLiteAsyncConnection(connectionFactory);

            connectionInfo.Connection = asyncConnection;

            return(connectionInfo);
        }