public AlarmMetadata AskAlarmMetadata(IAlarm alarm = null) { using (var alarmForm = new AlarmForm()) { if (alarm != null) { alarmForm.timeAlarmTime.Value = alarm.Time; alarmForm.timeAlarmTitle.Text = alarm.Title; } else { alarmForm.timeAlarmTitle.Clear(); alarmForm.timeAlarmTime.Value = DateTime.Now; } if (alarmForm.ShowDialog() == DialogResult.OK) { return(new AlarmMetadata { Title = alarmForm.timeAlarmTitle.Text, Time = alarmForm.timeAlarmTime.Value }); } return(null); } }
public AlarmMetadata AskAlarmMetadata(IAlarm alarm = null) { using (var alarmForm = new AlarmForm()) { if (alarm != null) { alarmForm.timeAlarmTime.Value = alarm.Time; alarmForm.timeAlarmTitle.Text = alarm.Title; } else { alarmForm.timeAlarmTitle.Clear(); alarmForm.timeAlarmTime.Value = DateTime.Now; } if (alarmForm.ShowDialog() == DialogResult.OK) { return new AlarmMetadata { Title = alarmForm.timeAlarmTitle.Text, Time = alarmForm.timeAlarmTime.Value }; } return null; } }