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();
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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>();
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 11
0
        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));
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
 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);
 }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
        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));
            }
        }
Ejemplo n.º 17
0
        //
        // 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));
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 21
0
        //
        // 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);
        }
Ejemplo n.º 24
0
        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);
        }
Ejemplo n.º 25
0
        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);
        }
Ejemplo n.º 26
0
        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);
        }
Ejemplo n.º 27
0
        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);
            }
        }