private void Save() { alarm.Name = txtName.Text; if (pickerTime.Time.Hours.ToString().Length == 1) { alarm.Hour = "0" + pickerTime.Time.Hours.ToString(); } else { alarm.Hour = pickerTime.Time.Hours.ToString(); } if (pickerTime.Time.Minutes.ToString().Length == 1) { alarm.Minute = "0" + pickerTime.Time.Minutes.ToString(); } else { alarm.Minute = pickerTime.Time.Minutes.ToString(); } alarm.Day = pickerDate.Date.Day; alarm.Month = pickerDate.Date.Month; alarm.Year = pickerDate.Date.Year; FileManager fileManager = new FileManager(); fileManager.SaveAlarm(alarm); if (alarm.Status) { XAlarmManager alarmManager = new XAlarmManager(); alarmManager.CancelAlarm(alarm); alarmManager.SetAlarm(alarm); } Navigation.PopAsync(); }
private void ImageButton_Clicked(object sender, EventArgs e) { var btn = ((ImageButton)sender); //alarmsButtonList.SelectedItem = null; for (int i = 0; i < alarms.Length; i++) { if (alarms[i].ClassID == btn.ClassId) { alarms[i].Toggle(); if (alarms[i].Status) { XAlarmManager alarmManager = new XAlarmManager(); alarmManager.SetAlarm(alarms[i]); } else { XAlarmManager alarmManager = new XAlarmManager(); alarmManager.CancelAlarm(alarms[i]); } FileManager fileManager = new FileManager(); fileManager.SaveAlarm(alarms[i]); btn.Source = alarms[i].ImageName; btn.HeightRequest = 120; btn.WidthRequest = 120; break; } } }