コード例 #1
0
        async private void btnUpdate_Clicked(object sender, EventArgs e)
        {
            var   db    = DependencyService.Get <IDatabaseConnection>().DbConnection();
            Items items = new Items()
            {
                Id             = Convert.ToInt32(entryID.Text),
                Name           = entryName.Text,
                Description    = entryDescription.Text,
                isComplete     = getComplete,
                mondayAlarm    = getMonday,
                tuesdayAlarm   = getTuesday,
                wednesdayAlarm = getWednesday,
                thursdayAlarm  = getThursday,
                fridayAlarm    = getFriday,
                saturdayAlarm  = getSaturday,
                sundayAlarm    = getSunday,
                reminderTime   = selectedTime.Time,
                hasReminder    = getReminder
            };

            db.Update(items);
            db.Close();
            var alarmsHandler = new AlarmsHandler();

            alarmsHandler.HandleAlarm();
            await Navigation.PopAsync();
        }
コード例 #2
0
        async private void btnAdd_Clicked(object sender, EventArgs e)
        {
            var db = DependencyService.Get <IDatabaseConnection>().DbConnection();

            db.CreateTable <Items>();

            var   maxPk = db.Table <Items>().OrderByDescending(c => c.Id).FirstOrDefault();
            Items items = new Items()
            {
                Id             = (maxPk == null ? 1 : maxPk.Id + 1),
                Name           = entryName.Text,
                Description    = entryDescription.Text,
                isComplete     = false,
                mondayAlarm    = getMonday,
                tuesdayAlarm   = getTuesday,
                wednesdayAlarm = getWednesday,
                thursdayAlarm  = getThursday,
                fridayAlarm    = getFriday,
                saturdayAlarm  = getSaturday,
                sundayAlarm    = getSunday,
                reminderTime   = getTime,
                hasReminder    = getReminder
            };

            db.Insert(items);
            await DisplayAlert(null, items.Name + " added to your daily list!", "Ok.");

            //After item is added return to HomePageView and set the alarms
            await Navigation.PopAsync();

            var alarmsHandler = new AlarmsHandler();

            alarmsHandler.HandleAlarm();
        }
コード例 #3
0
        protected override void OnResume()
        {
            // Handle when your app resumes
            //When the app resumes, check to see if the date has changed and if so reset the items in list
            CheckDate();
            //Alarms are redone the app is resumed
            var alarmsHandler = new AlarmsHandler();

            alarmsHandler.HandleAlarm();
        }