Esempio n. 1
0
 public override void OnReceive(Context context, Intent intent)
 {
     try {
         data = context.GetSharedPreferences("project_alarm", FileCreationMode.Private);
         if (data != null)
         {
             ICollection <string> alarmStrings = data.GetStringSet("alarms", null);
             alarmService = new AlarmService();
             if (alarmStrings != null)
             {
                 foreach (string a in alarmStrings)
                 {
                     alarmService.Alarms.Add(AlarmFactory.StringToAlarm(a));
                 }
                 alarmService.Alarms.Sort();
                 AlarmMngr.StartAlarm(alarmService.GetNextEnabledAlarm(), context);
             }
         }
     } catch (Exception ex) {
         Console.WriteLine(ex.Message);
     }
 }
Esempio n. 2
0
 protected override void OnResume()
 {
     base.OnResume();
     if (!gotActivityResult)
     {
         ICollection <string> alarmStrings = data.GetStringSet("alarms", null);
         alarmService.Alarms.Clear();
         if (alarmStrings != null)
         {
             foreach (string a in alarmStrings)
             {
                 alarmService.Alarms.Add(AlarmFactory.StringToAlarm(a));
             }
             alarmService.Alarms.Sort();
             alarmsListViewAdapter.NotifyDataSetChanged();
             UpdateAlarmManager();
         }
     }
     else
     {
         gotActivityResult = false;
     }
 }