private void TimerTick(object sender, EventArgs e) { DateTime now = DateTime.Now; if (now.Minute % 10 != 0 && !timerEnablePopup) { timerEnablePopup = true; } else if (now.Minute % 10 == 0 && timerEnablePopup) { BeepThread.BeepPlease(1200, 500); timerEnablePopup = false; if (!this.Visible) { this.currentEntry.Text = ""; this.console.Text = ""; ReadFiles(); this.Show(); this.ActiveControl = this.currentEntry; } } try { if (now.Date == reminderList[0].Date && now.Hour == reminderList[0].Hour && now.Minute == reminderList[0].Minute && !alarmBeep) { AlarmBeep(); } } catch (ArgumentOutOfRangeException) { return; } }
private void SubmitEntry(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && e.Shift == false) { BeepThread.BeepPlease(800, 500); this.Hide(); string[] output = { "[" + DateTime.Now.ToString() + "]\n" + this.currentEntry.Text + "\n\n" }; System.IO.File.AppendAllLines(files[1], output); this.currentEntry.Text = ""; } }
protected override void WndProc(ref Message m) { if (m.Msg == 0x0312) { int id = m.WParam.ToInt32(); StopAlarm(); if (id == 1 && this.Visible == false) { ReadFiles(); BeepThread.BeepPlease(1200, 500); this.Show(); this.currentEntry.Text = ""; this.console.Text = ""; Application.OpenForms[this.Name].Activate(); this.ActiveControl = this.currentEntry; } else if (id == 2 && this.Visible == true) { BeepThread.BeepPlease(800, 500); this.Hide(); } else if (id == 1 && this.Visible == true) { Application.OpenForms[this.Name].Activate(); this.ActiveControl = this.currentEntry; } else if (id == 3) { if (this.Visible == false) { ReadFiles(); BeepThread.BeepPlease(1200, 500); this.Show(); this.currentEntry.Text = ""; this.console.Text = ""; Application.OpenForms[this.Name].Activate(); this.ActiveControl = this.console; } else { Application.OpenForms[this.Name].Activate(); this.ActiveControl = this.console; } } } base.WndProc(ref m); }