//http://forums.xamarin.com/discussion/19362/xamarin-forms-splashscreen-in-android protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); string databasePath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); string databaseFull = System.IO.Path.Combine (databasePath, Global.databaseName); if (File.Exists (databaseFull) == true) { //it's not the first time var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid (); var cn = new SQLite.Net.SQLiteConnection (plat, databaseFull); var m = cn.Table<MacroCategories> ().ToList (); Global.k_MacroCategories = new MyObservableCollection<MacroCategories> (m); var c = cn.Table<Categories> ().ToList (); Global.K_Categories = new MyObservableCollection<Categories> (c); var p = cn.Table<POIs> ().ToList (); Global.K_POIs = new MyObservableCollection<POIs> (p); var cp = cn.Table<Categories_POIs> ().ToList (); Global.K_Categories_POIs = new MyObservableCollection<Categories_POIs> (cp); var pg = cn.Table<POIsPictures> ().ToList (); Global.K_POIsPictures = new MyObservableCollection<POIsPictures> (pg); Global.K_CCFs = Global.createCCFs (); Thread.Sleep (1); // Simulate a long loading process on app startup } else { Thread.Sleep (2000); // Simulate a long loading process on app startup } var intent = new Intent (this, typeof(MainActivity)); StartActivity (intent); Finish (); // Create your application here }
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 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; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); Xamarin.Forms.Forms.Init (this, bundle); var sqliteFilename = "TodoSQLite.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 = Resources.OpenRawResource(Resource.Raw.TodoSQLite); // RESOURCE NAME ### // create a write stream FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // write to the stream ReadWriteStream(s, writeStream); } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); var a = new App (); // Set the database connection string App.SetDatabaseConnection (conn); App.SetTextToSpeech (new Speech ()); LoadApplication (a); }
public SQLiteConnection GetConnection() { var dbPath = GetDatabasePath(); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); return(new SQLiteConnection(platform, dbPath)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ShareActivityContext = this; // HACK: for SpeakButtonRenderer to get an Activity/Context reference Xamarin.Forms.Forms.Init(this, bundle); //Xamarin.QuickUIMaps.Init (this, bundle); var sqliteFilename = "EvolveSQLite.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 = Resources.OpenRawResource(Evolve13.Resource.Raw.EvolveSQLite); // RESOURCE NAME ### // create a write stream FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // write to the stream ReadWriteStream(s, writeStream); } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection(conn); SetPage(App.GetMainPage()); }
public SQLiteConnection CreateConnection() { var sqliteFilename = "ExampleDB.db"; string documentsDirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsDirectoryPath, sqliteFilename); if (!File.Exists(path)) { using (var binaryReader = new BinaryReader(Android.App.Application.Context.Assets.Open(sqliteFilename))) { using (var binaryWriter = new BinaryWriter(new FileStream(path, FileMode.Create))) { byte[] buffer = new byte[2048]; int length = 0; while ((length = binaryReader.Read(buffer, 0, buffer.Length)) > 0) { binaryWriter.Write(buffer, 0, length); } } } } var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLite.Net.SQLiteConnection GetConnection() { var sqliteFilename = "TodoSQLite.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder var finalPath = Path.Combine(documentsPath, Settings.GeneralSettings); if (!Directory.Exists(finalPath)) { Directory.CreateDirectory(finalPath); } var path = Path.Combine(finalPath, 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); // // write to the stream // ReadWriteStream(s, writeStream); // } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Return the database connection return(conn); }
public void InitializeDatabase() { //Initialize database var sqliteFilename = "Eventarin.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder var path = System.IO.Path.Combine(documentsPath, sqliteFilename); // This is where we copy in the prepopulated database //Console.WriteLine (path); if (!File.Exists(path)) { FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); using (var s = Resources.OpenRawResource(Resource.Raw.Eventarin)) { ReadWriteStream(s, writeStream); } // RESOURCE NAME ### // create a write stream // write to the stream } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); App.SetDatabaseConnection(conn); // RefreshLocalData (); RefreshLocalDataSequentially(); }
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>(); }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); DroidDatabaseEnviroment databaseEnviroment = new DroidDatabaseEnviroment(); ISQLitePlatform platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); DatabaseService databaseService = new DatabaseService(databaseEnviroment, () => { SQLiteConnectionWithLock connectionWithLock = new SQLiteConnectionWithLock(platform, new SQLiteConnectionString(databaseEnviroment.DatabasePath, false)); SQLiteAsyncConnection connection = new SQLiteAsyncConnection(() => connectionWithLock); return(connection); }); await databaseService.InitializeDatabaseConnectionAsync(); await ApplicationSessionContext.Instance.InitializeConextAsync( new UserRepository(databaseService.DatabaseConnection)); BaseContainer.Instance.InitializeDependencies(databaseService.DatabaseConnection, () => ApplicationSessionContext.Instance); //Autologin Intent intent = ApplicationSessionContext.Instance.IsLogged ? new Intent(ApplicationContext, typeof(LogoutActivity)) : new Intent(ApplicationContext, typeof(LoginActivity)); StartActivity(intent); }
public SQLite.Net.SQLiteConnection GetConnection() { string dbFileName = "MCTDB.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.ToString(), dbFileName); //var path = Path.Combine(documentsPath, dbFileName); // This is where we copy in the prepopulated database Console.WriteLine(path); if (!File.Exists(path)) { var s = Forms.Context.Assets.Open("MCTDB.db3"); // RESOURCE NAME ### // create a write stream FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // write to the stream ReadWriteStream(s, writeStream); CopyDatabaseIfNotExists(); using (var asset = Forms.Context.Assets.Open("MCTDB.db3")) { using (var dest = File.Create(path)) { asset.CopyTo(dest); } } } 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() { var fileName = "RumbleApp.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, fileName); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connection = new SQLite.Net.SQLiteConnection(platform, path); return(connection); // COMMENT OUT ABOVE AND UNCOMMENT BELOW TO RECREATE THE db ON YOUR ANDROIDS LOCAL FILE FOLDER /* * var fileName = "RumbleApp.db3"; * // this line of code saves the DB to the MYFiles folder on your android which you can then go to to get the DB * var documentsPath =Android.OS.Environment.ExternalStorageDirectory.Path; * var path = Path.Combine (documentsPath, fileName); * * var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid (); * var connection = new SQLite.Net.SQLiteConnection (platform, path); * * return connection; */ }
public void MainDbTests() { var dbFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "mysequredb.db3"); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); string saltText = CryptoService.GenerateRandomKey(16); ISecureDatabase database = new MyDatabase(platform, dbFilePath, saltText); 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", 0).FirstOrDefault(); Assert.IsNotNull(userAccessedDirectly); Assert.AreEqual("Has AlTaiar", userAccessedDirectly.Name); Assert.AreNotEqual("very secure password :)", userAccessedDirectly.Password); }
public void StartApplication() { if (NearestApp == null) { Task.Run(() => { SQLite.Net.Interop.ISQLitePlatform platform; platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); string[] prefs = { Settings.UomDistance.ToString(), Settings.UomDistanceThreshold.ToString(), Settings.UomTime.ToString(), Settings.UomTimeThreshold.ToString() }; NearestApp = new Nearest(platform, new Utility(), prefs); }); } else { Report("Using existing NearestApp instance. Setting next trains", 0); } if (lastKnown != null && NearestApp != null) { GetTrainModels(lastKnown); Report("StartApplication => GetTrainModels", 0); } SetNextTrains("Start Application..."); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Xamarin.Forms.Forms.Init(this, bundle); var sqliteFilename = "TodoSQLite.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 = Resources.OpenRawResource(TodoXaml.Resource.Raw.TodoSQLite); // RESOURCE NAME ### // create a write stream FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // write to the stream ReadWriteStream(s, writeStream); } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection(conn); App.SetTextToSpeech(new Speech()); SetPage(App.GetMainPage()); }
public void MainDbTests() { var dbFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "mysequredb.db3"); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); 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", 0).FirstOrDefault(); Assert.IsNotNull(userAccessedDirectly); Assert.AreEqual("Has AlTaiar", userAccessedDirectly.Name); Assert.AreNotEqual("very secure password :)", userAccessedDirectly.Password); }
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 documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, sqliteFilename); if (!File.Exists(path)) { var s = Forms.Context.Resources.OpenRawResource(Resource.Raw.talkmanager1); FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); ReadWriteStream(s, writeStream); connectionInfo.IsInitializedDbStructure = false; } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connectionFactory = new Func <SQLiteConnectionWithLock>(() => new SQLiteConnectionWithLock(plat, new SQLiteConnectionString(path, storeDateTimeAsTicks: false))); var asyncConnection = new SQLiteAsyncConnection(connectionFactory); connectionInfo.Connection = asyncConnection; return(connectionInfo); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SpeakingActivityContext = this; // HACK: for SpeakButtonRenderer to get an Activity/Context reference Xamarin.Forms.Forms.Init (this, bundle); var sqliteFilename = "TodoSQLite.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 = Resources.OpenRawResource(Resource.Raw.TodoSQLite); // RESOURCE NAME ### // create a write stream FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // write to the stream ReadWriteStream(s, writeStream); } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection (conn); SetPage (App.GetMainPage ()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Xamarin.Forms.Forms.Init(this, bundle); //copy database out of assembly resources if needed var sqliteFilename = "clever_weather.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); if (!File.Exists(path)) { using (Stream stream = CleverWeather.SiteListUtils.GetEmbeddedResourceStream(System.Reflection.Assembly.GetAssembly(typeof(CleverWeather.SiteListUtils)), sqliteFilename)) using (FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write)) { ReadWriteStream(stream, writeStream); } } //connect to database if (File.Exists(path)) { var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connString = new SQLite.Net.SQLiteConnectionString(path, false); var conn = new SQLite.Net.SQLiteConnectionWithLock(platform, connString); App.Connection = new SQLite.Net.Async.SQLiteAsyncConnection(() => conn); } SetPage(App.GetMainPage()); }
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.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Return the database connection return conn; }
public SQLite.Net.SQLiteConnection CreateConnection() { var sqliteFilename = "LedgerBookDB.db3"; string documentsDirectoryPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentsDirectoryPath, sqliteFilename); // This is where we copy in our pre-created database if (!File.Exists(path)) { using (var binaryReader = new BinaryReader(Android.App.Application.Context.Assets.Open(sqliteFilename))) { using (var binaryWriter = new BinaryWriter(new FileStream(path, FileMode.Create))) { byte[] buffer = new byte[2048]; int length = 0; while ((length = binaryReader.Read(buffer, 0, buffer.Length)) > 0) { binaryWriter.Write(buffer, 0, length); } } } } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); return(conn); }
private void _verificaUtilizatorBackup(object ob, EventArgs ev) { try { string _bdInfo = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "Util.db3"); var _bd = new SQLiteConnection(_bdInfo); var _informatii = _bd.Table <Utilizator>(); var _verifica = _informatii.Where(cl => cl.AdresaEmail == emailCrypt.Text && cl.Parola == passCrypt.Text && cl.NumeClient == userCrypt.Text).FirstOrDefault(); if (_verifica != null) { var _ut = new UtilCriptat { //Id = Guid.NewGuid().ToString(), NumeClient = userCrypt.Text, AdresaEmail = emailCrypt.Text, Parola = passCrypt.Text }; string _bdInfoCriptare = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "Cript.db3"); var _bdCriptare = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); string _incriptare = CryptoService.GenerateRandomKey(24); var _cheie = "Prevenire RiscIT"; ISecureDatabase _bdSecurizata = new BDUtilizator(_bdCriptare, _bdInfoCriptare, _incriptare); var _ch = _bdSecurizata.SecureQuery <UtilCriptat>("SELECT * FROM UtilCriptat WHERE AdresaEmail= '" + _ut.AdresaEmail + "'AND Parola= '" + _ut.Parola + "'AND NumeClient='" + _ut.NumeClient + "'", _cheie, 0).FirstOrDefault(); if (_ch != null) { try { _bdSecurizata.SecureInsert(_ut, _cheie); userCrypt.SetTextColor(Color.DarkGreen); emailCrypt.SetTextColor(Color.DarkGreen); passCrypt.SetTextColor(Color.DarkGreen); Toast.MakeText(this, "Data encrypted. Backup security succeedeed!", ToastLength.Short).Show(); } catch (SQLiteException) { Toast.MakeText(this, "We could not encrypt data or data already encrypted..Backup security failed!", ToastLength.Short).Show(); } } else { Toast.MakeText(this, "Data already encrypted...", ToastLength.Short).Show(); } } else { Toast.MakeText(this, "Incorrect credentials! Do you have an account? If yes, try again!", ToastLength.Short).Show(); userCrypt.SetTextColor(Color.IndianRed); emailCrypt.SetTextColor(Color.IndianRed); passCrypt.SetTextColor(Color.IndianRed); } } catch (SQLiteException eroare) { Toast.MakeText(this, eroare.ToString(), ToastLength.Short).Show(); } }
public SQLiteConnection GetSqlConnection(string fileName) { var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, fileName); var plat=new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn=new SQLiteConnection(plat, path); return conn; }
public exerciseRepository() { dbPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); db = new SQLiteConnection(platform, Path.Combine(dbPath, dbName)); db.CreateTable <Exercise>(); }
public SQLite.Net.SQLiteConnection GetConnection() { var path = DependencyService.Get <IDatabase> ().Path; var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); return(conn); }
public SQLiteConnection GetConnection() { var path = Path.Combine(System.Environment.GetFolderPath(System.Environment. SpecialFolder.Personal), Const.PhoneDataBaseName); var platformAndroid = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); return(new SQLiteConnection(platformAndroid, path)); }
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.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLiteConnection(plat, path); return conn; }
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.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); return(conn); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); #region Database setup var sqliteFilename = "TodoSQLite.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 = Resources.OpenRawResource(RazorTodo.Resource.Raw.TodoSQLite); // RESOURCE NAME ### // create a write stream FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // write to the stream ReadWriteStream(s, writeStream); } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection(conn); #endregion // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var webView = FindViewById <WebView> (Resource.Id.webView); webView.Settings.JavaScriptEnabled = true; // Use subclassed WebViewClient to intercept hybrid native calls webView.SetWebViewClient(new RazorWebViewClient(this)); // Render the view from the type generated from RazorView.cshtml var model = App.Database.GetItems().ToList(); List <List <Data> > lista = model .GroupBy(u => u.Group) .Select(grp => grp.ToList()) .ToList(); var template = new TodoList() { Model = lista }; var page = template.GenerateString(); // Load the rendered HTML into the view with a base URL // that points to the root of the bundled Assets folder webView.LoadDataWithBaseURL("file:///android_asset/", page, "text/html", "UTF-8", null); }
public SQLiteAsyncConnection DbConnect(string dbName) { var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(folderPath, dbName); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connectionFactory = new Func <SQLiteConnectionWithLock>(() => _connection ?? (_connection = new SQLiteConnectionWithLock(platform, new SQLiteConnectionString(path, storeDateTimeAsTicks: false)))); return(new SQLiteAsyncConnection(connectionFactory)); }
/// <summary> /// Get local database /// </summary> /// <returns>New SQLite connection</returns> public SQLiteConnection GetConnection() { string fileName = "SteamUserData.db3"; string docsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var fullPath = Path.Combine(docsPath, fileName); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); return(new SQLiteConnection(platform, fullPath)); }
public SQLiteConnection GetConnection () { const string sqliteFilename = "database.db3"; var documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); var path = Path.Combine (documentsPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); //Create the connection var conn = new SQLiteConnection(plat,path); return conn; }
public SQLite.Net.SQLiteConnection GetConnection(string pathN) { var fileName = "RandomThought.db3"; var path = Path.Combine(pathN, fileName); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connection = new SQLite.Net.SQLiteConnection(platform, path); return(connection); }
public SQLite.Net.SQLiteConnection GetConnection() { const string sqliteFilename = "TodoSQLite.db3"; //データベース名 var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); //Documentsフォルダ var path = Path.Combine(documentsPath, sqliteFilename); //DBファイルのパス var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); return(conn); }
public SQLiteConnection DbConnection() { var dbName = "PillsDB.db3"; var path = Path.Combine(System.Environment. GetFolderPath(System.Environment. SpecialFolder.Personal), dbName); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); return(new SQLiteConnection(platform, path)); }
public AccesoDatos() { //DependencyService Donde lo estoy ejecutando? deendiendo de donde se ejecute se ira al archivo config var plataforma = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var directorioDB = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); connection = new SQLiteConnection(plataforma, System.IO.Path.Combine(directorioDB, "Articulo.db3")); connection.CreateTable <Articulo>(); }
public SQLite.Net.SQLiteConnection GetSQLiteConnection() { var fileName = "UserDatabase.db3"; var documentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentPath, fileName); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLite.Net.SQLiteConnection GetConnection() { var filename = "Student.db3"; var documentspath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentspath, filename); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connection = new SQLite.Net.SQLiteConnection(platform, path); return connection; }
public SQLiteDBConnection GetConnection() { var fileName = "PersonsDB.db3"; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, fileName); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connection = new SQLite.Net.SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, DatabaseHelper.DbFileName); var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); 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 path = Path.Combine(documentsPath, fileName); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connection = new SQLite.Net.SQLiteConnection(platform, path, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.SharedCache); return(connection); }
public SQLite.Net.SQLiteConnection GetConnection() { var sqliteFilename = "MyDataBase.db3"; string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); // 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 override void OnCreate() { base.OnCreate(); var sqliteFilename = "TaskDB.db3"; string libraryPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(libraryPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); conn = new SQLiteConnection(plat,path); TaskMgr = new TaskManager(conn); }
public SQLiteConnection GetConnection() { var fileName = "Mediando.db3"; var documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); var libraryPath = Path.Combine (documentsPath, "..", "Library"); var path = Path.Combine (libraryPath, fileName); System.IO.Directory.CreateDirectory(libraryPath); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid (); 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.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path, true); Console.WriteLine(path); App.SetSqlConnection(conn); }
public SQLite.Net.Async.SQLiteAsyncConnection GetConnection() { const string sqliteFilename = "Mais.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, sqliteFilename); // Cria a conexão var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var param = new SQLite.Net.SQLiteConnectionString(path, false); var conn = new SQLite.Net.Async.SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(plat, param)); return conn; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Forms.Init(this, savedInstanceState); var sqlPlatform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var databasePath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "linuxwochen.db"); var app = new www.linuxwochen.common.app.App(sqlPlatform, databasePath); this.LoadApplication(app); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); Xamarin.Forms.Forms.Init (this, bundle); var sqliteFilename = "ServiceReminder.db3"; string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); App.Connection = new SQLite.Net.SQLiteConnection(plat, path); // SetPage (App.GetMainPage ()); }
public SQLiteConnection GetConnection() { var nomeArquivo = "ECurso.db3"; var caminhoDocumento = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var caminho = Path.Combine(caminhoDocumento, nomeArquivo); var plataforma = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); //var plataforma = new SQLite.Net.Platform.XamariniOS.SQLitePlatformiOS(); //var plataforma = new SQLite.Net.Platform..WindowsPhone8.SQLitePlatformWP8(); var conexao = new SQLiteConnection(plataforma, caminho); return conexao; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); #region Database setup var sqliteFilename = "TodoSQLite.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 = Resources.OpenRawResource(RazorTodo.Resource.Raw.TodoSQLite); // RESOURCE NAME ### // create a write stream FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // write to the stream ReadWriteStream(s, writeStream); } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection (conn); #endregion // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); var webView = FindViewById<WebView> (Resource.Id.webView); webView.Settings.JavaScriptEnabled = true; // Use subclassed WebViewClient to intercept hybrid native calls webView.SetWebViewClient (new RazorWebViewClient (this)); // Render the view from the type generated from RazorView.cshtml var model = App.Database.GetItems ().ToList(); var template = new TodoList () { Model = model }; var page = template.GenerateString (); // Load the rendered HTML into the view with a base URL // that points to the root of the bundled Assets folder webView.LoadDataWithBaseURL("file:///android_asset/", page, "text/html", "UTF-8", null); }
public SQLite.Net.SQLiteConnection GetConnection() { var sqliteFilename = "BetDatabase.db3"; string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); var path = Path.Combine (documentsPath, sqliteFilename); /*if(!File.Exists(path)) { //Resource Name var resource = Forms.Context.Resources.OpenRawResource (Resource.zzz); //Create Write Stream FileStream writeStream = FileStream(path,FileMode.OpenOrCreate,FileAccess.Write); //Write to Stream ReadWriteStream(resource,writeStream); */ var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var conn = new SQLite.Net.SQLiteConnection (plat, path); return conn; }
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 documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, sqliteFilename); if (!File.Exists(path)) { var s = Forms.Context.Resources.OpenRawResource(Resource.Raw.talkmanager1); FileStream writeStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); ReadWriteStream(s, writeStream); connectionInfo.IsInitializedDbStructure = false; } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); var connectionFactory = new Func<SQLiteConnectionWithLock>(() => new SQLiteConnectionWithLock(plat, new SQLiteConnectionString(path, storeDateTimeAsTicks: false))); var asyncConnection = new SQLiteAsyncConnection(connectionFactory); connectionInfo.Connection = asyncConnection; return connectionInfo; }