コード例 #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);
                }
            }
        }
コード例 #2
0
ファイル: LocalBhasvicDB.cs プロジェクト: graceannx/Bhasvic10
        // ***** AlertCategoryTable queries

        static public bool updateAlertCategoryTable(AlertCategory alertCategory)
        {
            db.RunInTransaction(() =>
            {
                db.InsertOrReplace(alertCategory);
            });
            return(true);
        }
コード例 #3
0
ファイル: LocalBhasvicDB.cs プロジェクト: graceannx/Bhasvic10
 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);
 }