private void Timer_Elapsed(object sender, ElapsedEventArgs e) { DateTime currentTime = DateTime.Now; DateTime personTime = dateTimePicker.Value; if (currentTime.Hour == personTime.Hour && currentTime.Minute == personTime.Minute && currentTime.Second == personTime.Second) { timer.Stop(); try { UpdateLable update = UpdateDataLable; if (label1.InvokeRequired) { Invoke(update, label1, "Stop"); } SoundPlayer playing = new SoundPlayer(); playing.SoundLocation = @"C:\Windows\Media\Alarm03.wav"; playing.PlayLooping(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { DateTime currentTime = DateTime.Now; DateTime userTime = dateTimePicker1.Value; if (currentTime.Hour == userTime.Hour && currentTime.Minute == userTime.Minute && currentTime.Second == userTime.Second) { timer.Stop(); try { UpdateLable upd = UpdateDateLable; if (lbl1Status.InvokeRequired) { Invoke(upd, lbl1Status, "Stop"); } SoundPlayer player = new SoundPlayer(); player.SoundLocation = @"C:\Users\denis\Desktop\As1\As1.wav"; player.PlayLooping(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { DateTime currentTime = DateTime.Now; DateTime userTime = dateTimePicker1.Value; if (currentTime.Hour == userTime.Hour && currentTime.Minute == userTime.Minute && currentTime.Second == userTime.Second) { timer.Stop(); try { UpdateLable upd = UpdateDataLable; if (label1.InvokeRequired) { Invoke(upd, label1, "Stop"); } SoundPlayer player = new SoundPlayer(); playaudio(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void timer_Elapsed(Object sender, EventArgs e) { DateTime currentTime = DateTime.Now; DateTime userTime = dateTimePicker1.Value; if (currentTime.Hour == userTime.Hour && currentTime.Minute == userTime.Minute && currentTime.Second == userTime.Second) { timer.Stop(); try { UpdateLable up = UpdateDataLable; if (labelStatus.InvokeRequired) { Invoke(up, labelStatus, "Stop"); } SoundPlayer player = new SoundPlayer(); player.SoundLocation = @"C:\Users\Dell\Downloads\alarm.wav"; player.PlayLooping(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
//this function plays music from the time the timer starts till the time the user put private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { //calculate how much time has passed since timer began DateTime currentTIme = DateTime.Now; DateTime userTime = dateTimePicker.Value; if (currentTIme.Hour == userTime.Hour && currentTIme.Minute == userTime.Minute && currentTIme.Second == userTime.Second) { timer.Stop(); try { UpdateLable upd = UpdateDataLable; if (lblStatus.InvokeRequired) { Invoke(upd, lblStatus, "Running..."); } player.SoundLocation = @"C:\Windows\media\Alarm01.wav"; player.PlayLooping(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { DateTime currentTime = DateTime.Now; DateTime userTime = dateTimePicker1.Value; if (currentTime.Hour == userTime.Hour && userTime.Minute == currentTime.Minute && currentTime.Second == userTime.Second) { timer.Stop(); try { UpdateLable upd = UpdateDataLabel; if (label2.InvokeRequired) { Invoke(upd, label2, "Stop"); } SoundPlayer player = new SoundPlayer(); player.SoundLocation = @"F:\Clg class codes\Clg Mid term Lab\Digital Clock\clock4.wav"; player.PlayLooping(); MessageBox.Show("Ring !!RIng!!!!!!"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void button2_Click(object sender, EventArgs e) { timer.Stop(); UpdateLable upd = UpdatedataLable; if (label1.InvokeRequired) { Invoke(upd, label1, "stop"); } label1.Text = "Stop"; }
public void UpdateLB(String str) { UpdateLable ulb = new UpdateLable(this.OnUpdateLB); lbl.Invoke(ulb, new Object[] { str }); }