public void Init() { backgroundWorker.AddAction(() => { //创建本月数据 CreateMonthlyData(); //获取设置今日数据 tomatoDataToday = FindCreateTodayData(); }); backgroundWorker.Run(); config.Changed += Config_Changed; tray.MouseClickTrayIcon += Tray_MouseClickTrayIcon; tray.MouseMoveTrayIcon += Tray_MouseMoveTrayIcon; //工作计时器 workTimer = new DispatcherTimer(); workTimer.Tick += WorkTimer_Tick; workTimer.Interval = new TimeSpan(0, config.options.Tomato.WorkMinutes, 0); //休息计时器 restTimer = new DispatcherTimer(); restTimer.Tick += RestTimer_Tick;; restTimer.Interval = new TimeSpan(0, config.options.Tomato.ShortRestMinutes, 0); icorefreshTimer = new DispatcherTimer(); icorefreshTimer.Tick += icorefreshTimer_Tick;; /****调试模式代码****/ #if DEBUG workTimer.Interval = new TimeSpan(0, 0, 25); restTimer.Interval = new TimeSpan(0, 0, 5); #endif main.OnLeaveEvent += Main_OnLeaveEvent; }
public void Init() { workWatcher = new Stopwatch(); backgroundWorker.AddAction(() => { //迁移旧版本的XML数据 MigrateXMLDataToDb(); //创建本月数据 CreateMonthlyItems(); //获取设置今日数据 todayStatistic = FindCreate(); }); backgroundWorker.Run(); //开始计时 ResetStatisticTime(); }