private async void Initialize() { Window = new UIWindow(UIScreen.MainScreen.Bounds); Window.RootViewController = new LoginViewControler(); SQLitePlatformIOS platform = new SQLitePlatformIOS(); platform.SQLiteApi.Config(ConfigOption.MultiThread); IosDatabaseEnvironment databaseEnvironment = new IosDatabaseEnvironment(); DatabaseService databaseService = new DatabaseService(databaseEnvironment, () => { SQLiteConnectionWithLock connectionWithLock = new SQLiteConnectionWithLock(platform, new SQLiteConnectionString(databaseEnvironment.DatabasePath, false)); SQLiteAsyncConnection connection = new SQLiteAsyncConnection(() => connectionWithLock); return(connection); }); await databaseService.InitializeDatabaseConnectionAsync(); BaseContainer.Instance.InitializeDependencies(databaseService.DatabaseConnection, () => ApplicationSessionContext.Instance); await ApplicationSessionContext.Instance.InitializeConextAsync(); if (ApplicationSessionContext.Instance.User != null) { Window.RootViewController = new LogoutViewController(); } else { Window.RootViewController = new LoginViewControler(); } Window.MakeKeyAndVisible(); }
public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions) { Xamarin.Forms.Forms.Init(); Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.FontAwesomeModule()); FormsPlugin.Iconize.iOS.IconControls.Init(); UINavigationBar.Appearance.TintColor = UIColor.Black; var platform = new SQLitePlatformIOS(); const string dbName = "gamedb.db3"; var path = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User)[0].Path; var dbPath = Path.Combine(path, dbName); if (!File.Exists(dbPath)) { var appDir = NSBundle.MainBundle.ResourcePath; var seedFile = Path.Combine(appDir, dbName); if (File.Exists(seedFile)) { File.Copy(seedFile, dbPath); } } new Syncfusion.SfAutoComplete.XForms.iOS.SfAutoCompleteRenderer(); LoadApplication(new App(new SQLite.Net.SQLiteConnection(platform, dbPath, false))); return(base.FinishedLaunching(uiApplication, launchOptions)); }
public static void Startup() { SQLiteConnection connection = null; string dbLocation = "expensesDB.db3"; #if XAMARIN_ANDROID var library = Environment.GetFolderPath(Environment.SpecialFolder.Personal); dbLocation = Path.Combine(library, dbLocation); var platform = new SQLitePlatformAndroid(); connection = new SQLiteConnection(platform, dbLocation); #elif XAMARIN_IOS 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(); connection = new SQLiteConnection(platform, dbLocation); #endif ServiceContainer.Register <IExpenseService>(() => new ExpenseService(connection)); ServiceContainer.Register <IMessageDialog>(() => new MessageDialog()); ServiceContainer.Register <ExpensesViewModel>(); ServiceContainer.Register <ExpenseViewModel>(); }
public SQLiteConnection GetConnection() { var fileName = "Refeicoes.db3"; var documents = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documents, ".", "Library", fileName); var platform = new SQLitePlatformIOS(); return(new SQLiteConnection(platform, path)); }
public SQLiteConnection GetConnection() { var _documentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var _path = System.IO.Path.Combine(_documentPath, App.DBName); var _platform = new SQLitePlatformIOS(); var _connection = new SQLiteConnection(_platform, _path); return(_connection); }
public SQLiteConnection GetConnection() { var documentPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var path = Path.Combine(documentPath, App.DbName); var platform = new SQLitePlatformIOS(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { string documentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = System.IO.Path.Combine(documentPath, App.SqliteDb); var platform = new SQLitePlatformIOS(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { string _folderPath = System.Environment.GetFolderPath(System. Environment.SpecialFolder.Personal); var path = System.IO.Path.Combine(_folderPath, Xamarin.Sozluk.ClassUtils.SqLiteDbName); var platform = new SQLitePlatformIOS(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { SQLitePlatformIOS platform = new SQLitePlatformIOS(); string sqliteFilename = Configuration.DBname + ".db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder string path = Path.Combine(libraryPath, sqliteFilename); return(new SQLiteConnection(platform, path)); }
public SQLiteConnection GetConnection() { var DocumnetPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var Path = System.IO.Path.Combine (DocumnetPath, App2.App.dbName); var Platform = new SQLitePlatformIOS(); var connection = new SQLiteConnection(Platform, Path); return(connection); }
public SQLiteConnection DbConnection() { var dbName = "RestauranteDB.db3"; string personalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libraryFolder = Path.Combine(personalFolder, ".", "Library"); var path = Path.Combine(libraryFolder, dbName); var platform = new SQLitePlatformIOS(); return(new SQLiteConnection(platform, path)); }
public SQLiteConnection GetConnection() { string dbPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = System.IO.Path.Combine(dbPath, GlobalDegisken.localDbName); var platform = new SQLitePlatformIOS(); var connection = new SQLiteConnection(platform, path); return(connection); }
public SQLiteConnection GetConnection() { const string sqliteFilename = "TodoSQLite.db3"; //データベース名 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); }
public SQLiteConnection GetConnection() { if (_connection == null) { string folder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string databaseFileName = Path.Combine(folder, GlobalConfig.DATABASE_NAME); var platform = new SQLitePlatformIOS(); _connection = new SQLiteConnection(platform, databaseFileName); } return(_connection); }
public SQLiteConnection GetConnection() { string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libraryPath = Path.Combine(documentsPath, "..", "Library"); string path = Path.Combine(libraryPath, _fileName); SQLitePlatformIOS platform = new SQLitePlatformIOS(); SQLiteConnection connection = new SQLiteConnection(platform, path); return(connection); }
static Database() { //if (File.Exists (Util.DatabaseFile)) // File.Delete (Util.DatabaseFile); var platform = new SQLitePlatformIOS(); var param = new SQLiteConnectionString(DatabaseFile, false); if (Main == null) { Main = new Database(() => new SQLiteConnectionWithLock(platform, param)); } }
// // 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(); //string dbPath = FileAccessHelper. GetLocalFilePath("people.db3"); var platform = new SQLitePlatformIOS(); LoadApplication(new App(platform)); return(base.FinishedLaunching(app, options)); }
public SQLiteAsyncConnection GetConnection() { var sqliteFilename = "AAAAAAAAA.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 param = new SQLiteConnectionString(path, false); var connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, param)); return(connection); }
public SQLiteAsyncConnection GetAsyncConnection() { string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libraryPath = Path.Combine(documentsPath, "..", "Library"); string path = Path.Combine(libraryPath, _fileName); var platform = new SQLitePlatformIOS(); var param = new SQLiteConnectionString(path, false); var connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, param)); return(connection); }
public SQLiteAsyncConnection GetAsyncConnection() { var dbPath = GetDatabaseFilePath(); var platForm = new SQLitePlatformIOS(); var connectionFactory = new Func <SQLiteConnectionWithLock>( () => _sqLiteConnectionWithLock ?? (_sqLiteConnectionWithLock = new SQLiteConnectionWithLock( platForm, new SQLiteConnectionString(dbPath, storeDateTimeAsTicks: true)))); var asyncConnection = new SQLiteAsyncConnection(connectionFactory); return(asyncConnection); }
// // 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(); CarouselViewRenderer.Init(); CachedImageRenderer.Init(); UIApplication.SharedApplication.IdleTimerDisabled = true; string dbPath = FileAccessHelper.GetLocalFilePath("db.db3"); var platform = new SQLitePlatformIOS(); LoadApplication(new PortableApp.App(platform, dbPath)); return(base.FinishedLaunching(app, options)); }
public SQLiteAsyncConnection GetAsyncConnection() { const string sqliteFilename = "XamarinTemplate.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); }
public SQLiteAsyncConnection GetConnection() { var sqliteFilename = AppSettings.SQLiteDatabaseName; 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); }
public SQLiteAsyncConnection GetConnection() { var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var library = Path.Combine(documentsPath, "..", "Library"); var path = Path.Combine(library, Constants.DatabaseName); if (!File.Exists(path)) { File.Create(path); } var platform = new SQLitePlatformIOS(); var connectionString = new SQLiteConnectionString(path, storeDateTimeAsTicks: false); var connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, connectionString)); return(connection); }
public SQLiteConnection GetConnection() { // SQLiteデータベースパス var wFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var wSqlitePath = Path.Combine(wFolderPath, "..", "Library"); // SQLiteデータベース名 const string wSqliteName = "SampleSQLite.db"; // SQLiteデータベースのパスとファイル名を結合 var wPath = Path.Combine(wSqlitePath, wSqliteName); // SQLIteデータベースコネクションの生成 var wPlatform = new SQLitePlatformIOS(); var wConnect = new SQLiteConnection(wPlatform, wPath); return(wConnect); }
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); }
private SQLiteConnectionWithLock HandleFunc() { var dbPath = GetDatabasePath(); Debug.WriteLine("Sqlite Connection Path: " + dbPath); var platform = new SQLitePlatformIOS(); var connectionFactory = new Func <SQLiteConnectionWithLock>( () => { if (_conn == null) { _conn = new SQLiteConnectionWithLock(platform, new SQLiteConnectionString(dbPath, storeDateTimeAsTicks: true)); } return(_conn); }); return(connectionFactory.Invoke()); }
/// <summary> /// Initializes a new instance of the <see cref="T:ReactiveUIAroundMe.iOS.AppBootstrapper"/> class. /// </summary> public AppBootstrapper() { try { Router = new RoutingState(); Locator.CurrentMutable.RegisterConstant(this, typeof(IScreen)); HttpClientHandler clientHandler = new HttpClientHandler(); //_isWindows ? new HttpClientHandler() : new NativeMessageHandler(); clientHandler.UseCookies = false; clientHandler.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; // TODO: singletons, we want to pull resolved items from container, rather than outside declarations var sqliteplatform = new SQLitePlatformIOS(); var logger = new LoggeriOS(); var settings = new Settings(); var userDefaults = new UserDefaults(settings); // temp until settings page added userDefaults.Host = Config.BaseUrl; var device = new Device.Device(); var sqliteSetup = new SQLiteSetup(sqliteplatform); var sqliteStorage = new SQLiteStorage(sqliteSetup, logger); var scheduler = new ReactiveUIAroundMe.iOS.Threading.NSRunloopScheduler(); var webServiceController = new WebServiceController(sqliteStorage, logger, clientHandler, scheduler, userDefaults); var googleMapsWebServiceController = new GoogleMapsWebServiceController(sqliteStorage, logger, clientHandler, scheduler, userDefaults); var applicationStateHandler = new ApplicationStateHandler(sqliteStorage); var orientationHandler = new OrientationHandleriOS(); var pathLocator = new PathLocator(); var locationManager = new LocationManager(); // pages // todo: we could use reflection here Locator.CurrentMutable.Register(() => new LoginPage(), typeof(IViewFor <LoginPageViewModel>)); Locator.CurrentMutable.Register(() => new HomePage(), typeof(IViewFor <HomePageViewModel>)); Locator.CurrentMutable.Register(() => new SuperAdminPage(), typeof(IViewFor <SuperAdminPageViewModel>)); Locator.CurrentMutable.Register(() => new SearchResultsPage(), typeof(IViewFor <SearchResultsPageViewModel>)); Locator.CurrentMutable.Register(() => new MapPage(), typeof(IViewFor <MapPageViewModel>)); Locator.CurrentMutable.Register(() => new FlyoutMenuPage(), typeof(IViewFor <FlyoutMenuPageViewModel>)); // singletons Locator.CurrentMutable.RegisterLazySingleton(() => applicationStateHandler, typeof(ApplicationStateHandler)); Locator.CurrentMutable.RegisterLazySingleton(() => webServiceController, typeof(WebServiceController)); Locator.CurrentMutable.RegisterLazySingleton(() => googleMapsWebServiceController, typeof(GoogleMapsWebServiceController)); Locator.CurrentMutable.Register <ISettings>(() => settings); Locator.CurrentMutable.Register <IUserDefaults>(() => userDefaults); Locator.CurrentMutable.Register <ISQLitePlatform>(() => sqliteplatform); Locator.CurrentMutable.Register <ISQLiteSetup>(() => sqliteSetup); Locator.CurrentMutable.Register <ISQLiteStorage>(() => sqliteStorage); Locator.CurrentMutable.Register <Portable.Logging.ILogger>(() => logger); Locator.CurrentMutable.Register <IDevice>(() => device); Locator.CurrentMutable.Register <IOrientationHandler>(() => orientationHandler); Locator.CurrentMutable.Register <IPathLocator>(() => pathLocator); Locator.CurrentMutable.Register <IScheduler>(() => scheduler); Locator.CurrentMutable.Register <ILocationManager>(() => locationManager); Locator.CurrentMutable.Register <HttpClientHandler>(() => clientHandler); // converters Locator.CurrentMutable.RegisterConstant(new NotConverter(), typeof(IBindingTypeConverter)); //Locator.CurrentMutable.RegisterViewsForViewModels(this.GetType().GetTypeInfo().Assembly); _flyoutMenuViewModel = new FlyoutMenuPageViewModel(scheduler, applicationStateHandler, sqliteStorage, webServiceController, googleMapsWebServiceController, pathLocator, logger, device, this, locationManager); // Navigate to the opening page of the application Router.Navigate.Execute(new HomePageViewModel(scheduler, applicationStateHandler, sqliteStorage, webServiceController, googleMapsWebServiceController, pathLocator, logger, device, this, locationManager)); } catch (Exception e) { System.Diagnostics.Debug.Write(e); } }