public void stop_action(bool balloon) { AM_timer.Stop(); time_groupBox.Enabled = true; action_groupBox.Enabled = true; main_button.Text = "Start"; main_label.Text = "Auto Machine"; AM_notifyIcon.Text = main_label.Text; if (balloon == true) { AM_notifyIcon.BalloonTipIcon = ToolTipIcon.Info; AM_notifyIcon.ShowBalloonTip(5); } warning1 = 0; warning2 = 0; cancel = false; }
private void AM_timer_Tick(object sender, EventArgs e) { if (timer_warnings == true) { if (DateTime.Now.ToLongTimeString() == timer_time.AddMinutes(-2).ToLongTimeString()) { while (warning1 == 0) { AM_notifyIcon.BalloonTipIcon = ToolTipIcon.Info; AM_notifyIcon.BalloonTipTitle = action_comboBox.Text; AM_notifyIcon.BalloonTipText = WRN_Task + " 2 " + WRN_TaskSec; AM_notifyIcon.ShowBalloonTip(10); warning1 = 1; } } if (DateTime.Now.ToLongTimeString() == timer_time.AddMinutes(-1).ToLongTimeString()) { while (warning2 == 0) { Warning warningform = new Warning(this); warningform.ShowDialog(); warning2 = 1; } } } if (cancel == false) { if (DateTime.Now.ToLongTimeString() == timer_time.ToLongTimeString()) { action(timer_action); stop_action(false); } } else { stop_action(true); } }