Esempio n. 1
0
        private async Task loadAlarmsFromJSON()
        {
            List <Alarm> alarms;
            var          jsonSerializer = new DataContractJsonSerializer(typeof(List <Alarm>));

            try
            {
                var myStream = await ApplicationData.Current.LocalFolder.OpenStreamForReadAsync(ALARMS_FILE);

                alarms = (List <Alarm>)jsonSerializer.ReadObject(myStream);

                foreach (var a in alarms)
                {
                    AlarmUserControl alarmDisplay = new AlarmUserControl(this, a);
                    alarmDisplay.updateDisplay();
                    AlarmList_Panel.Children.Add(alarmDisplay);
                }
            }
            catch (Exception)
            {
                //Do nothing, file doesn't exist
            }
        }
Esempio n. 2
0
        private void PhoneAddAlarmButton_Click(object sender, RoutedEventArgs e)
        {
            AlarmUserControl alarmControl = new AlarmUserControl(this, new Alarm(DEFAULT_ALARM_SOUND, snoozeTime));

            AlarmList_Panel.Children.Add(alarmControl);
        }
Esempio n. 3
0
        /// General user input handling
        private void AddAlarmButton_Click(object sender, RoutedEventArgs e)
        {
            AlarmUserControl alarmControl = new AlarmUserControl(this, new Alarm(AlarmsManager.SNOOZE_TIME));

            AlarmList_Panel.Children.Add(alarmControl);
        }