Beispiel #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);
                }
            }
        }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NewsItemGrabber _newsItemGrabber;

            _newsItemGrabber = new NewsItemGrabber();
            LocalBhasvicDB.createNewsItemTable();
            //var jsonString = await _newsItemGrabber.getNews();
            Task.Run(async() =>
            {
                jsonString = await _newsItemGrabber.getNews();
            });
            while (jsonString.Equals("NotSet"))
            {
            }
            ;
            Console.WriteLine(jsonString);
            LocalBhasvicDB.updateDBWithJSON(jsonString);
            Console.WriteLine(LocalBhasvicDB.getItemList());
        }