public App()
        {
            // The root page of your application
            ISQLiteConnection connection = DependencyService.Get <ISQLiteConnection>();

            if (connection.GetConnection() != null)
            {
                Debug.WriteLine("SQLite connection is ready!");
            }

            MainPage = new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        new Label {
                            XAlign = TextAlignment.Center,
                            Text   = connection.GetDataBasePath()
                        }
                    }
                }
            };
        }
示例#2
0
文件: Repository.cs 项目: amixa/Kiosk
 public Repository(ISQLiteConnection connectionService)
 {
     _connectionService = connectionService;
     _connection        = _connectionService.GetConnection();
     _connection.CreateTableAsync <T>();
     //_connection.DropTableAsync<T>();
 }
        public async Task Initialize()
        {
            ConnectionInfo <SQLiteAsyncConnection> connectionInfo = await modConnectionInfo.GetConnection();

            modConnection = connectionInfo.Connection;

            if (connectionInfo.IsInitializedDbStructure)
            {
                return;
            }

            await modConnection.DropTableAsync <User>();

            await modConnection.CreateTableAsync <User>();
        }
        public App()
        {
            // Główna strona aplikacji
            ISQLiteConnection connection = DependencyService.Get <ISQLiteConnection>();

            if (connection.GetConnection() != null)
            {
                Debug.WriteLine("Połączenie SQLite gotowe!");
            }
            MainPage = new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        new Label {
                            HorizontalTextAlignment = TextAlignment.Center,
                            Text = connection.GetDataBasePath()
                        }
                    }
                }
            };
        }