示例#1
0
        public void timerClock_Tick(object sender, EventArgs e)
        {
            currentTime           = DateTime.Now;
            timeLabel.Text        = currentTime.ToString("HH:mm:ss");
            dateLabel.Text        = currentTime.ToString("dd.MM.yyyy");
            timeInAlarmLabel.Text = currentTime.ToString("HH:mm:ss");
            dateInAlarmlabel.Text = currentTime.ToString("dd.MM.yyyy");

            // compare current time with alarms list
            for (int i = 0; i < alarmsCheckedListBox.Items.Count; i++)
            {
                MyAlarm tempAlarm         = (MyAlarm)(alarmsCheckedListBox.Items[i]);
                String  tempDateAlarm     = Convert.ToDateTime(tempAlarm.AlarmTime).ToString("dd.MM.yyyy HH:mm");
                String  tempDateNow       = currentTime.ToString("dd.MM.yyyy HH:mm");
                int     compareDateResult = String.Compare(tempDateAlarm, tempDateNow, true);
                if (compareDateResult == 0)
                {
                    // sound
                    //System.Media.SystemSounds.Beep.Play();
                    // one notification
                    if (tempAlarm.IsNotify)
                    {
                        notifyAlarm(tempAlarm);
                        tempAlarm.IsNotify            = false;
                        alarmsCheckedListBox.Items[i] = tempAlarm;
                    }
                }
            }
        }
示例#2
0
        public void notifyAlarm(MyAlarm alarm)
        {
            var popupNotifier = new PopupNotifier();

            popupNotifier.TitleText     = "Alarm";
            popupNotifier.ContentText   = alarm.Notification;
            popupNotifier.IsRightToLeft = false;
            popupNotifier.Popup();
        }
示例#3
0
        private void addAlarmButton_Click(object sender, EventArgs e)
        {
            DateTime date    = dateTimePickerAlarm.Value;
            MyAlarm  myAlarm = new MyAlarm();

            myAlarm.AlarmTime    = date;
            myAlarm.Notification = alarmTextBox.Text;
            alarmsCheckedListBox.Items.Insert(0, myAlarm);
        }