public Timer(DispatcherTimer t, MusicManager m, int time, MainWindow w, int num, bool f) { pm = new ProcManager(); pm.init(); pm.addGameName("TIM"); pm.addGameName("chrome"); disTimer = t; //初始化 mc = m; learningTime = CountSecond = time; //时间 InitializeComponent(); main = w; //初始化主界面对象 NowNo = num; //将文件中数据数传入,防止覆盖 first = f; Start(); //调用开始计时函数 }
int timeSpan; //学习时长 public Timer(DispatcherTimer t, MusicManager m, int time, MainWindow w, int num, bool f, BitmapImage photo, string choice) { pm = new ProcManager(); pm.init(); timeSpan = int.Parse(choice); disTimer = t; //初始化 mc = m; learningTime = CountSecond = time; //时间 InitializeComponent(); main = w; //初始化主界面对象 NowNo = num; //将文件中数据数传入,防止覆盖 first = f; Start(); //调用开始计时函数 if (photo != null) { timer1.Source = photo; } }
//测试用 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(); }