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 } }
private void PhoneAddAlarmButton_Click(object sender, RoutedEventArgs e) { AlarmUserControl alarmControl = new AlarmUserControl(this, new Alarm(DEFAULT_ALARM_SOUND, snoozeTime)); AlarmList_Panel.Children.Add(alarmControl); }
/// 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); }