private void Form1_Load(object sender, EventArgs e) { AlarmTimer.Start(); //WholeControlsDisable(); //학번을 입력해야만 사용할 수 있도록 비활성화 ScheduleTabInit(); HookingInit(); AlarmMethod(); Form2 IdentificationForm = new Form2(); IdentificationForm.IDRegisterEvent += new Form2.IdentificationFormSendRegisterHandler(Identify); IdentificationForm.ShowDialog(); IniValueLoad(); KeyboardHookForShortcut.KeyDown += new KeyEventHandler(KeyboardHookForShortcut_KeyDown); KeyboardHookForShortcut.Start(); AfterSpinnerDeact(); AtSpinnerDeact(); ListenerStart(); /*easy style에 해당하는 hooking 이벤트 추가*/ HookingInit_for_easy(); }
private void StartButton_Click(object sender, EventArgs e) { string maskedText = EnteringTimeTextBox.Text; string[] timeData = maskedText.Split(':'); for (int i = 0; i < timeData.Length; i++) { timeData[i] = timeData[i].Trim(); } bool enteringTimeIsFilled = true; string formattedEnteringTime = "{0} : {1} : {2}"; foreach (string time in timeData) { if (time.Length != 2) { enteringTimeIsFilled = false; } } if (enteringTimeIsFilled) { formattedEnteringTime = String.Format(formattedEnteringTime, timeData); AlarmClockLabel.Text = formattedEnteringTime; EnteringTimeTextBox.Text = ""; AlarmTimer.Start(); } }
private void CheckAlarm(string key, AlarmTimer timer, int fleet, string subject) { if (timer.CheckAlarm(Step)) { SetNotification(key, fleet, subject); return; } var pre = TimeSpan.FromSeconds(Notifications[key].PreliminaryPeriod); if (pre == TimeSpan.Zero) { return; } if (timer.CheckAlarm(Step + pre)) { SetPreNotification(key, fleet, subject); } }
private void AlarmTimer_Tick(object sender, EventArgs e) { if (totalSeconds2 > 0) { TimeMethod(); LoadItems(); totalSeconds2--; int hours2 = totalSeconds2 / 3600; int minutes2 = (totalSeconds2 / 60) % 60; int seconds2 = (totalSeconds2 % 60); TimeSpan y = new TimeSpan(hours2, minutes2, seconds2); AlarmBox.Text = y.ToString(); //AlarmBox.BeginUpdate(); //AlarmBox.Items.Add(" " + y.ToString()); //AlarmBox.EndUpdate(); } else { for (int i = 1; i < 2; i++) { Console.Beep(); } AlarmTimer.Stop(); DialogResult result = (MessageBox.Show(" Put on snooze + 5 min ", " Time * up ", MessageBoxButtons.YesNo, MessageBoxIcon.Question)); switch (result) { case DialogResult.Yes: totalSeconds2 = 5 * 60; AlarmTimer.Start(); MessageBox.Show(" Added 5 mins "); break; case DialogResult.No: break; } } }
private void ResetBut_Click(object sender, EventArgs e) { bCurrent_Time = true; Start_StopBut.Text = "Start/Stop"; Start_StopBut.BackColor = default(Color); Start_StopBut.UseVisualStyleBackColor = true; Start_Stop_Countdown.Text = "Start/Stop"; Start_Stop_Countdown.BackColor = default(Color); Start_Stop_Countdown.UseVisualStyleBackColor = true; Current_Time.Visible = true; StopurTime.Visible = false; on1 = true; on2 = true; stopWatch.Reset(); Start_Stop_Countdown.Enabled = false; CountdownTimer.Stop(); Countdown_Time.ResetText(); Countdown_Time.Visible = false; OmGangBox.Items.Clear(); AlarmTimer.Stop(); AlarmBox.Items.Clear(); }
/// <summary> /// Constructs a new instance of the <see cref="CWClientScheduler"/> class. /// </summary> public CWClientScheduler() { // This call is required by the Windows.Forms Component Designer. InitializeComponent(); globals = Globals.Instance(); tmrStart = new System.Timers.Timer(); startTimer = new AlarmTimer(); if (globals.Settings.EnableScheduler) { startTimer.AlarmTime = globals.Settings.StartTime.AddMinutes(-5); } else { startTimer.AlarmTime = DateTime.Now.AddMinutes(1); } startTimer.Enabled = true; startTimer.OnAlarmBell += new EventHandler(startTimer_OnAlarmBell); startTimer.Start(); updateBackoff = new Backoff(BackoffSpeed.Linear); updating = false; }
private void SetTimerColor(Label label, AlarmTimer timer, DateTime now) { label.ForeColor = timer.IsFinished(now) ? CUDColors.Red : Color.Black; }
private void StopButton_Click(object sender, EventArgs e) { AlarmClockLabel.Text = ""; AlarmTimer.Stop(); }