static void Main() { Threads ParallelThread = new Threads(); DBAcces DataBase = new DBAcces(); DataBase.myConnection = new System.Data.OleDb.OleDbConnection(DataBase.connectString); DataBase.myConnection.Open(); // ParallelThread.DataBase = DataBase; Thread parallelThread = new Thread(new ParameterizedThreadStart(Threads.ParallelFunction)); parallelThread.Start(DataBase); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1(DataBase, parallelThread)); }
public static void ParallelFunction(object obj) { DBAcces DataBase = (DBAcces)obj; while (true) { DataBase.UpdateTime(); OleDbDataReader URLToCheck = DataBase.GetSitesReadyToCheck(); while (URLToCheck.Read()) { string URL = URLToCheck[0].ToString(); DataBase.UpdateDataAboutWorking(CheckIfWorking(URL), URL); } URLToCheck.Close(); DataBase.RefreshTime(); Thread.Sleep(1000); } }
public Form1(DBAcces Base, Thread thread) { InitializeComponent(); DateBase = Base; secondthread = thread; }