예제 #1
0
        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);
            }
        }
예제 #2
0
파일: MainForm.cs 프로젝트: zhiyix/Alarmy
        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;
            }
        }