예제 #1
0
        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 SQLiteConnection GetConnection(string path)
        {
            var fullPath = GetFullDatabasePath (path);

            var platform = new SQLitePlatformIOS ();

            var connectionWithLock = new SQLiteConnectionWithLock (platform, new SQLiteConnectionString (fullPath, true));
            return connectionWithLock;
        }
예제 #3
0
 public SQLiteConnection GetConnection()
 {
     const string sqliteFilename = "sqlite.db"; //データベース名
     var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); //Documentsフォルダ
     var libraryPath = Path.Combine(documentsPath, "..", "Library"); // ライブラリフォルダ
     var path = Path.Combine(libraryPath, sqliteFilename);//DBファイルのパス
     var plat = new SQLitePlatformIOS();
     var conn = new SQLiteConnection(plat, path);
     return conn;
 }
예제 #4
0
        public SQLite.Net.SQLiteConnection GetConnection(string pathN)
        {
            var fileName      = "RandomThought.db3";
            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var libraryPath   = Path.Combine(documentsPath, "..", "Library");
            var path          = Path.Combine(pathN, fileName);

            var platform   = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS();
            var connection = new SQLite.Net.SQLiteConnection(platform, path);

            return(connection);
        }
예제 #5
0
파일: SQLite_iOS.cs 프로젝트: SRCA/CPPApp
        public SQLiteConnection GetConnection()
        {
            var    sqliteFilename = "ChecklistDatabase.db3";
            string documentsPath  = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder
            string libraryPath    = new FileManage().GetLibraryFolder();                           //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);
        }
예제 #6
0
        public SQLiteConnection GetConnection()
        {
            var sqliteFilename = "IncidentsSQLite.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 platform = new SQLitePlatformIOS ();
            var sqLiteConnectionString = new SQLiteConnectionString(path, false);

            var conn = new SQLiteConnectionWithLock (platform, sqLiteConnectionString);
            return conn;
        }
예제 #7
0
	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);
		// 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;
	}
예제 #8
0
        public SQLiteConnection GetConnection()
        {
            var arquivo = "LojaMobile.db3";

            var caminhoDocumento = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            var caminhoBiblioteca = Path.Combine(caminhoDocumento, "..", "Library");

            var caminho = Path.Combine(caminhoBiblioteca, arquivo);

            var plataforma = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS();
            var conexao    = new SQLite.Net.SQLiteConnection(plataforma, caminho);

            return(conexao);
        }
예제 #9
0
        public SQLiteAsyncConnection GetConnection()
        {
            const string sqliteFilename = "Conferences.db3";
            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var libraryPath = Path.Combine(documentsPath, "..", "Library");
            var path = Path.Combine(libraryPath, sqliteFilename);

            var platform = new SQLitePlatformIOS();

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

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

            return connection;
        }
예제 #10
0
파일: SQLite_iOS.cs 프로젝트: Dietando/App
		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);

			// This is where we copy in the prepopulated database
			Console.WriteLine (path);
			if (!File.Exists (path)) {
				File.Copy (sqliteFilename, path);
			}
			var plataform = new SQLitePlatformIOS();
			var conn = new SQLiteConnection (plataform, path);

			// Return the database connection 
			return conn;
		}
        public SQLiteConnection GetConnection()
        {
            var fileName = "contactDB.db3"; //Actual FileName "contactDatabase.db3";
            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var libraryPath = Path.Combine(documentsPath, "..", "Library");
            var path = Path.Combine(libraryPath, fileName);

            ////New
            //if (!File.Exists(path))
            //{
            //    File.Copy(fileName, path);
            //}

            var platform = new SQLitePlatformIOS();
            var connection = new SQLiteConnection(platform, path);

            return connection;
        }