Esempio n. 1
0
        /// <summary>
        /// 设置不提醒操作
        /// </summary>
        /// <param name="hour">-1时关闭;0打开;大于0则在到达设定的值(小时)后重新启动</param>
        private void SetNoReset(int hour)
        {
            config.options.General.Noreset     = true;
            menuItem_NoReset_OneHour.IsChecked = false;
            menuItem_NoReset_TwoHour.IsChecked = false;
            menuItem_NoReset_Forver.IsChecked  = false;
            menuItem_NoReset_Off.IsChecked     = false;
            menuItem_NoReset.IsChecked         = true;
            noresetTimer.Stop();
            UpdateIcon("dizzy");
            if (hour == -1)
            {
                //关闭
                config.options.General.Noreset = false;
                menuItem_NoReset.IsChecked     = false;
                mainService.Start();
                UpdateIcon("sunglasses");
            }
            else if (hour == 0)
            {
                //直到下次启动
                menuItem_NoReset.IsChecked = true;
                mainService.Pause(false);
            }
            else
            {
                //指定计时
                menuItem_NoReset.IsChecked = true;
                mainService.Pause(false);

                noresetTimer.Interval = new TimeSpan(hour, 0, 0);
                noresetTimer.Tick    += (e, c) =>
                {
                    SetNoReset(-1);
                    menuItem_NoReset_Off.IsChecked = true;
                    noresetTimer.Stop();
                };
                noresetTimer.Start();
            }
        }
Esempio n. 2
0
        private void menuItem_norest_Click(object sender, EventArgs e)
        {
            var item = sender as System.Windows.Forms.MenuItem;

            item.Checked = !item.Checked;
            config.options.General.Noreset = item.Checked;
            if (item.Checked)
            {
                //不要提醒
                UpdateIcon("dizzy");
                mainService.Pause();
            }
            else
            {
                //继续
                UpdateIcon("sunglasses");
                mainService.Start();
            }
        }