예제 #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();
        }