public static void Startup() { SQLiteConnection connection = null; string dbLocation = "expensesDB.db3"; #if __ANDROID__ var library = Environment.GetFolderPath(Environment.SpecialFolder.Personal); dbLocation = Path.Combine(library, dbLocation); var platform = new SQLitePlatformAndroid(); connection = new SQLiteConnection(platform, dbLocation); #elif __IOS__ CurrentPlatform.Init(); var docsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(docsPath, "../Library/"); dbLocation = Path.Combine(libraryPath, dbLocation); var platform = new SQLitePlatformIOS(); connection = new SQLiteConnection(platform, dbLocation); #elif WINDOWS_PHONE var platform = new SQLitePlatformWP8(); dbLocation = Path.Combine(ApplicationData.Current.LocalFolder.Path, dbLocation); connection = new SQLiteConnection(platform, dbLocation); #endif ServiceContainer.Register<IMessageDialog>(() => new MessageDialog()); ServiceContainer.Register<ICloudService>(AzureService.Instance); ServiceContainer.Register<IExpenseService>(() => new ExpenseService(connection)); ServiceContainer.Register<ExpensesViewModel>(); ServiceContainer.Register<ExpenseViewModel>(); }
public SQLiteAsyncConnection GetConnection() { string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string path = Path.Combine(documentsPath, AppResources.DatabaseName); var platfrom = new SQLitePlatformAndroid(); var syncConnection = new SQLiteConnectionWithLock(platfrom, new SQLiteConnectionString(path, false)); return new SQLiteAsyncConnection(() => syncConnection); }
public DBComm() { //var db=Assets. var path = Path.Combine(documentsPath, dbNameDota2); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLiteConnection (platform ,path); this.Connect = conn; }
public virtual SQLiteConnection GetConnection(string path) { var platform = new SQLitePlatformAndroid (); SQLiteConnection connectionWithLock; string fullPath = GetFullDatabasePath (path); connectionWithLock = new SQLiteConnectionWithLock (platform, new SQLiteConnectionString (fullPath, true)); return connectionWithLock; }
/// <summary> /// Gets the connection. /// </summary> /// <returns>The connection.</returns> public SQLiteConnection GetConnection() { const string FileName = "TreeWatchDB.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, FileName); var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return connection; }
public SQLiteConnection getConnection() { var filename = "Cover1.db3"; var documentspath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentspath, filename); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { var sqliteFilename = "IncidentsSQLite.db3"; string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine (documentsPath, sqliteFilename); var platform = new SQLitePlatformAndroid (); var sqLiteConnectionString = new SQLiteConnectionString(path, false); var conn = new SQLiteConnectionWithLock (platform, sqLiteConnectionString); return conn; }
public SQLiteConnection GetConnection () { var sqliteFilename = "DataBaseDietando.db3"; string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); var plataform = new SQLitePlatformAndroid (); // Create the connection var conn = new SQLiteConnection(plataform,path); // Return the database connection return conn; }
public SQLite.Net.SQLiteConnection GetConnection () { var sqliteFilename = "MeezureSQLite.db3"; string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); //File.Delete (path); // Create the connection var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Return the database connection return conn; }}
public SQLiteConnection GetConnection() { // 保存フォルダ 以下Let's Note // Android 5以下 // /data/data/XamarinBlankApp.Droid/files/CaterinaSQLite.db3 // Let's Emulator 5 // // Android 6 エミュレータ:/data/user/0/XamarinBlankApp.Droid/files/CaterinaSQLite.db3 const string sqliteFilename = "CaterinaSQLite.db3"; //データベース名 var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documentsフォルダ var path = Path.Combine(documentsPath, sqliteFilename); // DBファイルのパス var plat = new SQLitePlatformAndroid(); var conn = new SQLiteConnection(plat, path); return conn; }
public SQLiteAsyncConnection GetConnection() { const string sqliteFilename = "Conferences.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, sqliteFilename); var platform = new SQLitePlatformAndroid(); var connectionWithLock = new SQLiteConnectionWithLock( platform, new SQLiteConnectionString(path, true)); var connection = new SQLiteAsyncConnection(() => connectionWithLock); return connection; }
public DBComm(string key) { string dbName = ""; switch (key) { case "DOTA2": dbName = dbNameDota2; break; case "CSGO": dbName = dbNameCs; break; case "Hearthstone": dbName = dbNameHs; break; } var path = Path.Combine(documentsPath, dbName); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLiteConnection (platform ,path); this.Connect = conn; }
public SQLiteConnection GetConnection() { var fileName = "contactDB.d3b"; //"contactDatabase.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, fileName); //if (!File.Exists(path)) //{ // var s = Forms.Context.Resources.OpenRawResource(Resource.Raw.contactDatabase); // // create a write stream // FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // // write to the stream // ReadWriteStream(s, writeStream); //} var platform = new SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return connection; }
public SQLiteConnection GetConnection() { Log.Debug("SQLite_Android", "TEST: SQLite_Android initiated"); var sqliteFilename = "kompedb.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); Log.Debug("SQLite_Android", "TEST: Before new SQLitePlatformAndroid();"); // last print // Error no implementation for interface method SQLite.Net.Interop.ISQLiteApi::SourceID() // in class SQLite.Net.Platform.XamarinAndroid.SQLiteApiAndroid ISQLitePlatform platform = new SQLitePlatformAndroid(); Log.Debug("SQLite_Android", "TEST: Before new SQLiteConnection(platform, path);"); // Create the connection var conn = new SQLiteConnection(platform, path); // Return the database connection Log.Debug("SQLite_Android", "TEST: Before return"); return conn; }