示例#1
0
文件: MT.cs 项目: rwobig93/MangoTime
        private static void ThreadMinuteManual()
        {
            BackgroundWorker worker = new BackgroundWorker()
            {
                WorkerReportsProgress = true
            };

            worker.DoWork += (ws, we) =>
            {
                while (true)
                {
                    try
                    {
                        // Sleep on startup to prevent exception for Bot not having full enumeration
                        Thread.Sleep(TimeSpan.FromSeconds(30));
                        Jobs.CheckOnMango();
                    }
                    catch (Exception ex)
                    {
                        Log($"EXCEPTION: {ex.Message}{Environment.NewLine}{ex.StackTrace}", LogSeverity.Critical);
                    }
                    Thread.Sleep(TimeSpan.FromMinutes(1));
                }
            };
            worker.RunWorkerAsync();
        }