private void btnNewTimer_Click(object sender, EventArgs e) { BLIO.Log("btnNewTimer clicked!"); MaterialTimerPopup quickTimer = new MaterialTimerPopup(); quickTimer.Show(); }
public MaterialTimerPopup() { MaterialSkin.MaterialSkinManager.Instance.AddFormToManage(this); InitializeComponent(); instance = this; this.Opacity = 0; //Set the location within the remindme window. //This prompt can be moved, but inititally will be set to the middle of the location of RemindMe MaterialForm1 remindme = (MaterialForm1)Application.OpenForms["MaterialForm1"]; if (remindme != null && remindme.Visible) { this.StartPosition = FormStartPosition.Manual; this.Location = new Point(remindme.Location.X + ((remindme.Width / 2) - this.Width / 2), remindme.Location.Y + ((remindme.Height / 2) - (this.Height / 2))); } else { this.StartPosition = FormStartPosition.CenterScreen; } tmrFadeIn.Start(); tbTime.KeyUp += TimerPopup_KeyUp; tbNote.KeyUp += TimerPopup_KeyUp; this.KeyUp += TimerPopup_KeyUp; tbTime.KeyDown += numericOnly_KeyDown; tbTime.KeyPress += numericOnly_KeyPress; this.MaximumSize = this.Size; this.MinimumSize = this.Size; this.TopMost = true; this.BringToFront(); this.Focus(); this.ActiveControl = tbTime; if (!this.Focused) { this.Activate(); } BLIO.Log("TimerPopup created"); }
/// <summary> /// Looks for key combinations to launch the timer form (to set a timer quickly) /// </summary> /// <param name="sender"></param> /// <param name="e">The keyeventargs which contains the pressed keys</param> private void GlobalKeyPressDown(object sender, KeyEventArgs e) { if (!e.Shift && !e.Control && !e.Alt) //None of the key key's (get it?) pressed? return. { return; } if (BLLocalDatabase.Setting.Settings.EnableQuickTimer != 1) //Not enabled? don't do anything { return; } //Good! now let's check if the KeyCode is not alt shift or ctrl if (e.KeyCode == Keys.Alt || e.KeyCode == Keys.ControlKey || e.KeyCode == Keys.ShiftKey) { return; } timerHotkey = BLLocalDatabase.Hotkey.TimerPopup; timerCheckHotKey = BLLocalDatabase.Hotkey.TimerCheck; if (MaterialTimerPopup.Instance == null && e.Modifiers.ToString().Replace(" ", string.Empty) == timerHotkey.Modifiers && e.KeyCode.ToString() == timerHotkey.Key) { //Don't allow other applications to also fire this key combination, ctrl+shift+r would for example reload the page at the same time e.Handled = true; BLIO.Log("Timer hotkey combination pressed!"); MaterialTimerPopup quickTimer = new MaterialTimerPopup(); quickTimer.ShowDialog(); } if (MaterialTimerCheck.Instance == null && MUCTimer.RunningTimers.Count > 0 && e.Modifiers.ToString().Replace(" ", string.Empty) == timerCheckHotKey.Modifiers && e.KeyCode.ToString() == timerCheckHotKey.Key) { //Don't allow other applications to also fire this key combination, ctrl+shift+r would for example reload the page at the same time e.Handled = true; BLIO.Log("Timer check hotkey combination pressed!"); MaterialTimerCheck check = new MaterialTimerCheck(); materialSkinManager.AddFormToManage(check); check.Show(); } }
private void TimerPopup_FormClosed(object sender, FormClosedEventArgs e) { instance = null; }