コード例 #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();
        }