Exemple #1
0
        protected override async void OnAppearing()
        {
            //override back button
            if (OnBackButtonPressed())
            {
                await Navigation.PushAsync(new MainPage
                {
                    BindingContext = new MainPage()
                });
            }

            base.OnAppearing();
            try
            {
                InitializeDatabase ini = new InitializeDatabase();
                //use script to fill database if previous database has been deleted
                List <TuitionFees> tuitionFees = await App.Database.GetTuittionFeesListAsync();

                if (tuitionFees.Count() == 0)
                {
                    ini.populateDatabase();
                }
            }
            catch (Exception)
            {
                Console.WriteLine(">>> The database can't be read try to import a database in .db3 format (SQLite)");
            }
        }
        protected override async void OnAppearing()
        {
            //override back button
            if (OnBackButtonPressed())
            {
                await Navigation.PushAsync(new MainPage
                {
                    BindingContext = new MainPage()
                });
            }

            base.OnAppearing();
            InitializeDatabase ini = new InitializeDatabase();
            //use script to fill database if previous database has been deleted
            List <TuitionFees> tuitionFees = await App.Database.GetTuittionFeesListAsync();

            if (tuitionFees.Count() == 0)
            {
                ini.populateDatabase();
            }
        }