示例#1
0
        public void Start()
        {
            workTimer.Interval = new TimeSpan(0, config.options.Tomato.WorkMinutes, 0);
            restTimer.Interval = new TimeSpan(0, config.options.Tomato.ShortRestMinutes, 0);

            //播放提示音
            if (config.options.Tomato.IsWorkStartSound)
            {
                sound.Play(Enums.SoundType.TomatoWorkStartSound);
            }

            //  交互模式
            if (config.options.Tomato.IsEnabledInteractiveModel)
            {
                WorkDialog();
            }
            else
            {
                workTimer.Start();
                timerWatcher.Restart();
                tray.UpdateIcon("red-tomato-10");
                icorefreshTimer.Interval = new TimeSpan(0, 0, config.options.Tomato.WorkMinutes * 60 / 10);
                icorefreshTimer.Start();
            }
        }
示例#2
0
 //工作提醒
 private void WorkDialog()
 {
     //播放提示音
     if (config.options.Tomato.IsWorkStartSound)
     {
         sound.Play(Enums.SoundType.TomatoWorkStartSound);
     }
     //通知弹窗
     worktoast = new Project1UIToast();
     worktoast.SetIcon("pack://application:,,,/ProjectEye;component/Resources/tomato.ico");
     worktoast.OnButtonClick += Worktoast_OnButtonClick;
     worktoast.OnAutoHide    += Worktoast_OnAutoHide;
     worktoast.Alert($"{Application.Current.Resources["Lang_TomatoTimer"]}", $"{Application.Current.Resources["Lang_TomatoWorkfinishTip3"]}", $"{config.options.Tomato.WorkMinutes} {Application.Current.Resources["Lang_Minutes"]}", 60,
                     new string[] {
         $"{Application.Current.Resources["Lang_TomatoStart"]}",
         $"{Application.Current.Resources["Lang_TomatoEnd"]}"
     });
 }
示例#3
0
        //工作提醒
        private void WorkDialog()
        {
            //播放提示音
            if (config.options.Tomato.IsWorkStartSound)
            {
                sound.Play(Enums.SoundType.TomatoWorkStartSound);
            }
            //通知弹窗
            var worktoast = new Project1UIToast();

            worktoast.SetIcon("pack://application:,,,/ProjectEye;component/Resources/tomato.ico");
            worktoast.OnButtonClick += Worktoast_OnButtonClick;
            worktoast.OnAutoHide    += Worktoast_OnAutoHide;
            worktoast.Alert("番茄提示", "准备进入工作时间,请保持专注,我会在结束时提醒您,准备好了吗?", $"时间{config.options.Tomato.WorkMinutes}分钟", 60,
                            new string[] {
                "准备就绪",
                "结束"
            });
        }
示例#4
0
        private void preAlertTimer_Tick(object sender, EventArgs e)
        {
            //到达预提醒时间弹出通知
            Debug.WriteLine(DateTime.Now.ToString());

            if (main.isBreakReset())
            {
                //跳过本次
                SetPreAlertAction(PreAlertAction.Break);
            }
            else
            {
                //预提醒弹出

                preAlertHasTime = config.options.Style.PreAlertTime - 1;

                //通知数据模型
                var toastModel = new PreAlertModel();
                ParseModel(toastModel);

                //通知弹窗
                var toast = new Project1UIToast();
                if (config.options.Style.PreAlertIcon != "")
                {
                    toast.SetIcon(config.options.Style.PreAlertIcon);
                }
                toast.OnAutoHide    += Toast_OnAutoHide;
                toast.OnButtonClick += Toast_OnButtonClick;
                toast.Alert(toastModel, config.options.Style.PreAlertTime,
                            new string[] {
                    "好的",
                    "跳过本次"
                });

                //播放通知提示音
                if (config.options.Style.IsPreAlertSound)
                {
                    sound.Play();
                }

                //计时器
                var timer = new DispatcherTimer();
                timer.Interval = new TimeSpan(0, 0, 1);
                timer.Tick    += (ee, cc) =>
                {
                    preAlertHasTime--;
                    ParseModel(toastModel);
                    if (preAlertHasTime <= 0)
                    {
                        timer.Stop();
                    }
                };
                timer.Start();
            }
        }