예제 #1
0
파일: Timer.xaml.cs 프로젝트: 12Jack21/Tide
        private void GiveUp(object sender, RoutedEventArgs e)  //放弃
        {
            //存放当前一次学习中使用的程序信息,用List存储,并将其传到学习记录窗口
            List <Proc> procResult = pm.countResult();

            mc.Puase();
            disTimer.Stop();

            MessageBoxResult quit = MessageBox.Show("你确定要放弃本次学习吗?", "提示", MessageBoxButton.OKCancel);

            if (quit == MessageBoxResult.OK)
            {
                disTimer.Tick -= new EventHandler(disTimer_Tick);

                int length = learningTime - CountSecond;  //已学习时长
                                                          //转换为字符串,传入参数
                String timeRecord        = String.Format("{0:D2}", length / 60 / 60) + ":" + String.Format("{0:D2}", (length / 60) % 60) + ":" + String.Format("{0:D2}", length % 60);
                LearningRecordWindow lrw = new LearningRecordWindow(NowNo, false, timeRecord, procResult);
                lrw.ShowDialog();
                NowNo++;
                LearningRecordService.ShowAll();
                //实现主界面的显示,本界面的关闭
                this.Close();
                main.Visibility = Visibility.Visible;
                main.InitializeComponent();
            }
            else
            {
                disTimer.Start();
                mc.play();
            }
        }
예제 #2
0
        //测试用
        public static void Main0(string[] args)
        {
            ProcManager pm = new ProcManager();

            pm.init();
            pm.gameList.Add("TIM");
            int i = 0;

            while (i <= 20)
            {
                pm.onceMonitor();
                i++;
                if (!pm.checkGameTime())
                {
                    Console.WriteLine("Game above the required time!!!");
                    break;
                }
            }
            pm.countResult();
        }