Esempio n. 1
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();

            NewsItemGrabber _newsItemGrabber;

            _newsItemGrabber = new NewsItemGrabber();
            LocalBhasvicDB.createNewsItemTable();
            var jsonString = await _newsItemGrabber.getNews();

            Console.WriteLine(jsonString);
            LocalBhasvicDB.updateDBWithJSON(jsonString);
            Console.WriteLine(LocalBhasvicDB.getItemList());

            // Initialise AlertCategory Table if this is the first time the App is run

            if (LocalBhasvicDB.getTableInfo("AlertCategory").Count == 0)
            {
                LocalBhasvicDB.createAlertCategoryTable();
                var alertCat = new AlertCategory();
                foreach (var category in ChosenCategories.categories)
                {
                    alertCat.Alert    = true;
                    alertCat.Category = category;
                    LocalBhasvicDB.updateAlertCategoryTable(alertCat);
                }
            }
        }
Esempio n. 2
0
        // ***** AlertCategoryTable queries

        static public bool updateAlertCategoryTable(AlertCategory alertCategory)
        {
            db.RunInTransaction(() =>
            {
                db.InsertOrReplace(alertCategory);
            });
            return(true);
        }
Esempio n. 3
0
 static public bool initialiseAlertTable()
 {
     if (LocalBhasvicDB.getTableInfo("AlertCategory").Count == 0)
     {
         LocalBhasvicDB.createAlertCategoryTable();
         var alertCat = new AlertCategory();
         foreach (var category in ChosenCategories.categories)
         {
             alertCat.Alert    = true;
             alertCat.Category = category;
             LocalBhasvicDB.updateAlertCategoryTable(alertCat);
         }
     }
     return(true);
 }