コード例 #1
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();
            }
        }
コード例 #2
0
ファイル: TomatoService.cs プロジェクト: Planshit/ProjectEye
 //工作提醒
 private void WorkDialog()
 {
     //通知弹窗
     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
ファイル: TomatoService.cs プロジェクト: Planshit/ProjectEye
        private void Dialog(string title, string content, string subtitle = "")
        {
            //播放提示音
            if (config.options.Tomato.IsWorkEndSound)
            {
                sound.Play(Enums.SoundType.TomatoWorkEndSound);
            }
            //通知弹窗
            var toast = new Project1UIToast();

            toast.SetIcon("pack://application:,,,/ProjectEye;component/Resources/tomato.ico");
            toast.OnButtonClick += Toast_OnButtonClick;
            toast.Alert(title, content, subtitle, 30,
                        new string[] {
                $"{Application.Current.Resources["Lang_Yes"]}",
            });
        }
コード例 #4
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[] {
                "准备就绪",
                "结束"
            });
        }