public ClearFilesControlServiceTask(Log log) { this.log = log; SystemDataIsLoaded = false; Worker = new SaleThread(); Worker.ThreadName = "ClearOldFilesControl"; Worker.Priority = ThreadPriority.BelowNormal; Worker.Work += Worker_Work; Start(); }
void Worker_Work(object sender, ThreadWorkEventArgs e) { while (!e.Cancel) { try { DeleteOldFiles(Globals.GetPath(PathEnum.Logs), "*." + Globals.LogExtention, 30, SearchOption.TopDirectoryOnly); } catch { } // Период - 10 минут if (!e.Cancel) { SaleThread.Sleep(600000); } } }
public ThreadWorkEventArgs(SaleThread thread) { Thread = thread; }