예제 #1
0
        /// <summary>
        /// Adds an alarm to the storage, and schedules the alarm in the notifications platform
        /// </summary>
        /// <param name="alarm"></param>
        /// <returns></returns>
        public static async Task AddAlarm(MyAlarm alarm)
        {
            try
            {
                // Generate Id for it
                alarm.Id = Guid.NewGuid();

                Alarms.Add(alarm);

                await Task.Run(async delegate
                {
                    await SaveAlarmsAsync();

                    AlarmHelper.ScheduleAlarm(alarm);
                });
            }

            catch { }
        }