コード例 #1
0
ファイル: FrmAlarm.cs プロジェクト: sumin2123/StudyDesktopApp
        private void MyTimer_Tick(object sender, EventArgs e)
        {
            DateTime curDate = DateTime.Now;

            LblDate.Text = curDate.ToShortDateString();
            LblTime.Text = curDate.ToString("hh:mm:ss");

            if (IsSetAlarm == true) // 알람 설정이 되었다면
            {
                // 알람 시간하고 현재시간 일치하면 알람울림
                if (SetDay == DateTime.Today &&
                    SetTime.Hour == curDate.Hour &&
                    SetTime.Minute == curDate.Minute &&
                    SetTime.Second == curDate.Second)
                {
                    //IsSetAlarm = false; // 알람 설정 종료
                    BtnRelease_Click(sender, e);
                    mediaPlayer.launchURL(@"C:\Users\mini2\Desktop\Study Repository\StudyDesktopApp\WinformApp\ExcerciseWinApp\AlarmClockApp\medias/alarm.mp3");
                    mediaPlayer.controls.play();

                    MessageBox.Show("알람!!!", "알람", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }