public SQLite.Net.SQLiteConnection GetConnection() { var sqliteFilename = "quinieleros.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); // This is where we copy in the prepopulated database Console.WriteLine(path); if (!File.Exists(path)) { /*var s = Forms.Context.Resources.OpenRawResource(Resource.Raw.totalSQLite); // RESOURCE NAME ###*/ // create a write stream /*using (StreamReader sr = new StreamReader (Resource.Raw.totalSQLite)) { FileStream writeStream = new FileStream (path, FileMode.OpenOrCreate, FileAccess.Write); // write to the stream ReadWriteStream (sr, writeStream); }*/ } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Return the database connection return conn; }
public SQLite.Net.SQLiteConnection CreateConnection() { var sqliteFilename = "LedgerBookDB.db3"; string docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libFolder = Path.Combine(docFolder, "..", "Library", "Databases"); if (!Directory.Exists(libFolder)) { Directory.CreateDirectory(libFolder); } string path = Path.Combine(libFolder, sqliteFilename); // This is where we copy in the pre-created database if (!File.Exists(path)) { var existingDb = NSBundle.MainBundle.PathForResource("LedgerBookDB", "db3"); File.Copy(existingDb, path); } var iOSPlatform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLite.Net.SQLiteConnection(iOSPlatform, path); // Return the database connection return(connection); }
private void OnTouched(object sender, EventArgs e) { var dbFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "mysequredb.db3"); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); ISecureDatabase database = new MyDatabase(platform, dbFilePath, new CryptoService()); var keySeed = "my very very secure key seed. You should use PCLCrypt strong random generator for this"; var user = new SampleUser() { Name = "Has AlTaiar", Password = "******", Bio = "Very cool guy :) ", Id = Guid.NewGuid().ToString() }; var inserted = database.SecureInsert <SampleUser>(user, keySeed); Console.WriteLine("Sample Object was inserted securely? {0} ", inserted); var userFromDb = database.SecureGet <SampleUser>(user.Id, keySeed); Console.WriteLine("User was accessed back from the database: username= {0}, password={1}", userFromDb.Name, userFromDb.Password); // need to establish a direct connection to the database and get the object to test the encrypted value. var directAccessDb = (SQLiteConnection)database; var userAccessedDirectly = directAccessDb.Query <SampleUser>("SELECT * FROM SampleUser", 0).FirstOrDefault(); Console.WriteLine("User was accessed Directly from the database (with no decryption): username= {0}, password={1}", userAccessedDirectly.Name, userAccessedDirectly.Password); }
public SQLiteAsyncConnection GetConnection () { var sqliteFilename = "HomezigSQLite.db3"; string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); // This is where we copy in the prepopulated database //Console.WriteLine (path); if (!File.Exists(path)) { //var s = Forms.Context.Resources.OpenRawResource(Resource.Raw.TodoSQLite); // RESOURCE NAME ### // create a write stream //FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // write to the stream //ReadWriteStream(s, writeStream); } //var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); //var conn = new SQLite.Net.Async.SQLiteAsyncConnection(plat, path); var connectionFactory = new Func<SQLiteConnectionWithLock>(()=>new SQLiteConnectionWithLock(plat, new SQLiteConnectionString(path, storeDateTimeAsTicks: false))); var conn = new SQLiteAsyncConnection(connectionFactory); //conn.ExecuteAsync ("PRAGMA encoding = UTF8"); // Return the database connection return conn; }
public void MainDbTests() { var dbFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "mysequredb.db3"); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); ISecureDatabase database = new MyDatabase(platform, dbFilePath); var keySeed = "my very very secure key seed. You should use PCLCrypt strong random generator for this"; var user = new SampleUser() { Name = "Has AlTaiar", Password = "******", Bio = "Very cool guy :) ", Id = Guid.NewGuid().ToString() }; var inserted = database.SecureInsert <SampleUser>(user, keySeed); Assert.AreEqual(1, inserted); Assert.AreNotEqual("very secure password :)", user.Password); var userFromDb = database.SecureGet <SampleUser>(user.Id, keySeed); Assert.IsNotNull(userFromDb); Assert.AreEqual("Has AlTaiar", userFromDb.Name); Assert.AreEqual("very secure password :)", userFromDb.Password); var directAccessDb = (SQLiteConnection)database; var userAccessedDirectly = directAccessDb.Query <SampleUser>("SELECT * FROM SampleUser").FirstOrDefault(); Assert.IsNotNull(userAccessedDirectly); Assert.AreEqual("Has AlTaiar", userAccessedDirectly.Name); Assert.AreNotEqual("very secure password :)", userAccessedDirectly.Password); }
public SQLiteConnection GetConnection() { string documentPath; string libraryPath; if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var documentUrl = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User)[0]; documentPath = documentUrl.Path; } else { documentPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } libraryPath = Path.Combine(documentPath, "..", "Library", "Databases"); if (!Directory.Exists(libraryPath)) { Directory.CreateDirectory(libraryPath); } var databasePath = Path.Combine(libraryPath, sqliteFilename); CopyDatabaseIfNotExists(databasePath); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLite.Net.SQLiteConnection(platform, databasePath); return(connection); }
public void MainDbTests() { var dbFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "mysequredb.db3"); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); ISecureDatabase database = new MyDatabase(platform, dbFilePath); var keySeed = "my very very secure key seed. You should use PCLCrypt strong random generator for this"; var user = new SampleUser() { Name = "Has AlTaiar", Password = "******", Bio = "Very cool guy :) ", Id = Guid.NewGuid().ToString() }; var inserted = database.SecureInsert<SampleUser>(user, keySeed); Assert.AreEqual(1, inserted); Assert.AreNotEqual("very secure password :)", user.Password); var userFromDb = database.SecureGet<SampleUser>(user.Id, keySeed); Assert.IsNotNull(userFromDb); Assert.AreEqual("Has AlTaiar", userFromDb.Name); Assert.AreEqual("very secure password :)", userFromDb.Password); var directAccessDb = (SQLiteConnection)database; var userAccessedDirectly = directAccessDb.Query<SampleUser>("SELECT * FROM SampleUser").FirstOrDefault(); Assert.IsNotNull(userAccessedDirectly); Assert.AreEqual("Has AlTaiar", userAccessedDirectly.Name); Assert.AreNotEqual("very secure password :)", userAccessedDirectly.Password); }
public static void Startup() { #if __MOBILE__ SQLite.Net.SQLiteConnection connection = null; SQLite.Net.Interop.ISQLitePlatform platform = null; string dbLocation = "videoDB.db3"; #endif #if XAMARIN_ANDROID var library = Environment.GetFolderPath(Environment.SpecialFolder.Personal); dbLocation = Path.Combine(library, dbLocation); platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); #elif XAMARIN_IOS var docsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var library = Path.Combine(docsPath, "../Library/"); dbLocation = Path.Combine(library, dbLocation); platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); #elif WINDOWS_PHONE platform = new SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8(); #elif NETFX_CORE platform = new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(); #endif ServiceContainer.Register<IMovieService>(() => new MovieService()); #if __MOBILE__ connection = new SQLite.Net.SQLiteConnection(platform, dbLocation); ServiceContainer.Register<IStorageService>(() => new StorageService(connection)); ServiceContainer.Register<IMessageDialog>(() => new Video.PlatformSpecific.MessageDialog()); #endif ServiceContainer.Register<MoviesViewModel>(); ServiceContainer.Register<MovieViewModel>(); }
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); var sqliteFilename = "TodoSQLite.db3"; string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); // This is where we copy in the prepopulated database Console.WriteLine (path); if (!File.Exists (path)) { File.Copy (sqliteFilename, path); } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection (conn); // window.RootViewController = new HybridRazorViewController (); window.RootViewController = new UINavigationController(new NativeListViewController ()); // make the window visible window.MakeKeyAndVisible (); return true; }
public OrderListViewController() : base(new RootElement("Order list"), true) { orders = new List <Order>(); Style = UITableViewStyle.Plain; NavigationItem.SetRightBarButtonItem( new UIBarButtonItem(UIBarButtonSystemItem.Add, (sender, args) => { NavigationController.PushViewController(new AddOrderViewController(database), true); }), true); string dbPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "orders.db3"); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); database = new SQLiteConnection(platform, dbPath); database.CreateTable <Order>(); database.CreateTable <OrderPosition>(); UpdateList(); }
//If it's the first time, make a local copy of the database and return a connection for that file path. //after the first time, making the copy may be skipped. public SQLiteConnection GetConnection() { var sqliteFilename = "numoDatabase.db"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libraryPath = Path.Combine(documentsPath, "..", "Library"); var path = Path.Combine(libraryPath, sqliteFilename); try { //---copy only if file does not exist--- if (!File.Exists(path)) { File.Copy(sqliteFilename, path); } } catch (Exception e) { Console.WriteLine(e.Message); } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); return(conn); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); var sqliteFilename = "TodoSQLite.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); // This is where we copy in the prepopulated database Console.WriteLine(path); if (!File.Exists(path)) { File.Copy(sqliteFilename, path); } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection(conn); window.RootViewController = new RazorViewController(); // make the window visible window.MakeKeyAndVisible(); return(true); }
public SQLiteConnection CreateConnection() { var sqliteFilename = "Employee.db"; string docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libFolder = Path.Combine(docFolder, "..", "Library", "Databases"); if (!Directory.Exists(libFolder)) { Directory.CreateDirectory(libFolder); } string path = Path.Combine(libFolder, sqliteFilename); if (!File.Exists(path)) { var existingDb = NSBundle.MainBundle.PathForResource("ExampleDB", "db"); File.Copy(existingDb, path); } var iOSPlatform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLiteConnection(iOSPlatform, path); return(connection); }
public SQLite.Net.SQLiteConnection GetConnection() { string path = FileAccessHelper.GetFilePath("mycity_db.db"); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLite.Net.SQLiteConnection(platform, path); return(connection); }
public SQLite.Net.SQLiteConnection GetConnection(string filename) { string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, filename); var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); return(conn); }
public SQLiteConnection GetSqlConnection(string fileName) { var documentPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(documentPath, "..", "Library"); var path = Path.Combine(libraryPath, fileName); var plat=new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn=new SQLiteConnection(plat, path); return conn; }
public SQLiteConnection GetConnection() { var sqliteFilename = "BuscaPorVoz.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLiteConnection(plat, path); return conn; }
public SQLiteConnection GetConnection () { var sqliteFilename = "qmunicate.db3"; string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); string libraryPath = Path.Combine (documentsPath, "..", "Library"); var path = Path.Combine(libraryPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); return conn; }
public SQLiteAsyncConnection DbConnect(string dbName) { var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var librarypPath = Path.Combine(documentsPath, "..", "Library"); var path = Path.Combine(librarypPath, dbName); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connectionFactory = new Func <SQLiteConnectionWithLock>(() => _connection ?? (_connection = new SQLiteConnectionWithLock(platform, new SQLiteConnectionString(path, storeDateTimeAsTicks: false)))); return(new SQLiteAsyncConnection(connectionFactory)); }
public SQLiteConnection GetConnection() { string sqliteFilename = "StarWarsPeopleDatabase.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libraryPath = Path.Combine(documentsPath, "..", "Library"); var path = Path.Combine(libraryPath, sqliteFilename); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); return(new SQLiteConnection(path)); }
public SQLite.Net.SQLiteConnection GetConnection() { var sqliteFilename = "TSPM.db3"; var resourcesPath = Environment.GetFolderPath(Environment.SpecialFolder.Resources); var path = Path.Combine(resourcesPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Return the database connection return(conn); }
public SQLiteConnection GetConnection() { var sqliteFilename = "UserInformation.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libraryPath = Path.Combine(documentsPath, "..", "Library"); var path = Path.Combine(libraryPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLiteConnection(plat, path); return(conn); }
public SQLiteConnection GetConnection() { //Figure out where the SQLite database will be. var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); _pathToDatabase = Path.Combine(documentsPath, fileName); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLite.Net.SQLiteConnection(platform, _pathToDatabase); return(connection); }
public SQLiteConnection DbConnection() { var dbName = "PillsDB.db3"; string personalFolder = System.Environment. GetFolderPath(Environment.SpecialFolder.Personal); string libraryFolder = Path.Combine(personalFolder, "..", "Library"); var path = Path.Combine(libraryFolder, dbName); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); return(new SQLiteConnection(platform, path)); }
public SQLite.SQLiteConnection GetConnection() { var fileName = "Student.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(documentsPath, "..", "Library"); var path = Path.Combine(libraryPath, fileName); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLite.SQLiteConnection(path); return(connection); }
public SQLiteConnectionProviderIOS(string filename) { var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var sqliteFilename = string.Format("{0}.db3", filename); string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder DbPath = Path.Combine(libraryPath, sqliteFilename); // Create the connection _connection = new SQLiteConnection(platform, DbPath); }
public SQLiteConnection GetConnection() { var sqliteFilename = "QuizSQLite.db3"; string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); // Create the connection var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Return the database connection return conn; }
private SQLiteConnection GetConnection() { var fileName = "Abalon.db3"; var libraryPath = Path.Combine(NSBundle.MainBundle.BundlePath, "Assets"); var path = Path.Combine(libraryPath, fileName); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { var filename = "Accounts.db3"; string documentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(documentPath, "..", "Library"); var path = Path.Combine(documentPath, filename); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, DatabaseHelper.DbFileName); // Create the connection var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLiteConnection(plat, path); // Return the database connection return(conn); }
public SQLite.Net.SQLiteConnection GetConnection() { var fileName = "Urvent.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(documentsPath, "..", "Library"); var path = Path.Combine(libraryPath, fileName); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLite.Net.SQLiteConnection(platform, path, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.SharedCache); return(connection); }
public SQLite.Net.SQLiteConnection GetConnection() { var fileName = "Actu.db3"; var documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); var libraryPath = Path.Combine (documentsPath, "..", "Library"); var path = Path.Combine (libraryPath, fileName); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS (); var connection = new SQLite.Net.SQLiteConnection (platform, path); return connection; }
public static void SetupDatabase() { var sqliteFilename = "codemania.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path, true); Console.WriteLine(path); App.SetSqlConnection(conn); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); string dbPath = GetDatabasePath("RealmPerformance.db"); var param = new SQLiteConnectionString(dbPath, false); var connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, param)); LoadApplication(new RealmPerformance.App(connection)); return(base.FinishedLaunching(app, options)); }
public SQLite.Net.SQLiteConnection GetConnection() { // Create the connection var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS (); var conn = new SQLite.Net.SQLiteConnection (plat, FilePath); // Return the database connection var d = conn.GetTableInfo ("Person"); var m = conn.Table<Person> ().Table; return conn; }
public SQLite.Net.SQLiteConnection GetConnection() { // Create the connection var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, FilePath); // Return the database connection var d = conn.GetTableInfo("Person"); var m = conn.Table <Person> ().Table; return(conn); }
public void RegisterSQLiteDependencies(ContainerBuilder builder) { var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(documentsPath, "..", "Library"); var databasePath = Path.Combine(libraryPath, "widgets1.sqlite"); SQLiteConnection conn; var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); conn = new SQLiteConnection(platform, databasePath, storeDateTimeAsTicks: false); builder.RegisterInstance(conn).SingleInstance(); builder.RegisterModule <XOFFSQLiteAutoFacModule>(); }
public SQLite.Net.SQLiteConnection GetConnection() { var sqliteFilename = "FlightDataSQLite.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 plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Return the database connection return(conn); }
public SQL.SQLiteConnection GetConnection(string db) { var sqliteFilename = "ACD_" + db + ".db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); // Create the connection var plat = new SQL.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQL.SQLiteConnection(plat, path, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.FullMutex, false); // Return the database connection //conn.StoreDateTimeAsTicks = false; return(conn); }
public void SetConnection() { var sqliteFilename = "VikingVnrc.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); if (!File.Exists(path)) { File.Create(path); } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); App._connection = conn; }
public SQLiteConnection GetConnection() { string DocumentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string DatabasePath = Path.Combine(DocumentPath, "SavedNotes.db3"); if (!File.Exists(DatabasePath)) { File.Create(DatabasePath); } var platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var connection = new SQLiteConnection(platform, DatabasePath); return(connection); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { Current = this; // create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); // make the window visible window.MakeKeyAndVisible(); // create our nav controller navController = new UINavigationController(); // create our home controller based on the device // if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { homeViewController = new Tasky.Screens.HomeScreen(); // Styling UINavigationBar.Appearance.TintColor = UIColor.FromRGB(38, 117, 255); // nice blue UITextAttributes ta = new UITextAttributes(); ta.Font = UIFont.FromName("AmericanTypewriter-Bold", 0f); UINavigationBar.Appearance.SetTitleTextAttributes(ta); ta.Font = UIFont.FromName("AmericanTypewriter", 0f); UIBarButtonItem.Appearance.SetTitleTextAttributes(ta, UIControlState.Normal); var sqliteFilename = "TaskDB.db3"; // we need to put in /Library/ on iOS5.1 to meet Apple's iCloud terms // (they don't want non-user-generated data in Documents) string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "../Library/"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); conn = new SQLiteConnection(plat, path); TaskMgr = new TaskManager(conn); // push the view controller onto the nav controller and show the window navController.PushViewController(homeViewController, false); window.RootViewController = navController; window.MakeKeyAndVisible(); return(true); }
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { Current = this; // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); // make the window visible window.MakeKeyAndVisible (); // create our nav controller navController = new UINavigationController (); // create our home controller based on the device // if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { homeViewController = new Tasky.Screens.HomeScreen(); // Styling UINavigationBar.Appearance.TintColor = UIColor.FromRGB (38, 117 ,255); // nice blue UITextAttributes ta = new UITextAttributes(); ta.Font = UIFont.FromName ("AmericanTypewriter-Bold", 0f); UINavigationBar.Appearance.SetTitleTextAttributes(ta); ta.Font = UIFont.FromName ("AmericanTypewriter", 0f); UIBarButtonItem.Appearance.SetTitleTextAttributes(ta, UIControlState.Normal); var sqliteFilename = "TaskDB.db3"; // we need to put in /Library/ on iOS5.1 to meet Apple's iCloud terms // (they don't want non-user-generated data in Documents) string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine (documentsPath, "../Library/"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); conn = new SQLiteConnection(plat, path); TaskMgr = new TaskManager(conn); // push the view controller onto the nav controller and show the window navController.PushViewController(homeViewController, false); window.RootViewController = navController; window.MakeKeyAndVisible (); return true; }
public SQLite.Net.SQLiteConnection GetConnection() { string fileName="ROK_MobileApp.db"; string bundlePath = NSBundle.MainBundle.ResourcePath; string sourcePath = Path.Combine (bundlePath,fileName); string dbPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), fileName); if (!File.Exists (dbPath)) { File.Copy (sourcePath, dbPath); Console.WriteLine ("Copied DB"); } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS (); var conn = new SQLite.Net.SQLiteConnection (plat, dbPath); return conn; }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching (UIApplication app, NSDictionary options) { Forms.Init (); // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); var sqliteFilename = "TodoSQLite.db3"; string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder //string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder string libraryPath = documentsPath.Replace("Documents", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); // This is where we copy in the prepopulated database Console.WriteLine (path); if (!File.Exists (path)) { File.Copy (sqliteFilename, path); } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection (conn); App.SetTextToSpeech (new Speech ()); // configure Vernacular Catalog.Implementation = new ResourceCatalog { GetResourceById = id => { var resource = NSBundle.MainBundle.LocalizedString(id, null); return resource == id ? null : resource; }, }; // If you have defined a view, add it here: // window.RootViewController = navigationController; window.RootViewController = App.GetMainPage ().CreateViewController (); // make the window visible window.MakeKeyAndVisible (); return true; }
public SQLite.Net.SQLiteConnection GetConnection() { var sqliteFilename = "TodoSQLite.db3"; string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); // This is where we copy in the prepopulated database Console.WriteLine (path); if (!File.Exists (path)) { File.Copy (sqliteFilename, path); } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Return the database connection return conn; }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching (UIApplication app, NSDictionary options) { Forms.Init (); // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); window.TintColor = UIColor.Black; UINavigationBar.Appearance.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.Black}); UINavigationBar.Appearance.BarTintColor = UIColor.Black; UIBarButtonItem.Appearance.TintColor = UIColor.Black; UIBarButtonItem.Appearance.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.Black}, UIControlState.Normal ); var sqliteFilename = "TodoSQLite.db3"; string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); // This is where we copy in the prepopulated database Console.WriteLine (path); if (!File.Exists (path)) { File.Copy (sqliteFilename, path); } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection (conn); App.SetTextToSpeech (new Speech ()); // If you have defined a view, add it here: // window.RootViewController = navigationController; window.RootViewController = App.GetMainPage ().CreateViewController (); // make the window visible window.MakeKeyAndVisible (); return true; }