//Tests //Basic test parallel private void RunBasicTests() { while (running) { lblRunning.Dispatcher.Invoke(new Action(() => lblRunning.Text = "Running Tests")); Parallel.Invoke( //Cpu usage test - invoke the action for updating result to the UI () => { lblCpuUsage.Dispatcher.Invoke(new Action(() => lblCpuUsage.Text = ConnectionTester.TestCPUPerformance().ToString() + "%")); }, //Ram usage test - invoke the action for updating result to the UI () => { lblRamUsage.Dispatcher.Invoke(new Action(() => lblRamUsage.Text = ConnectionTester.TestRamPerformance().ToString() + "%")); }, //Processes running test - invoke the action for updating result to the UI () => { lblProcesses.Dispatcher.Invoke(new Action(() => lblProcesses.Text = ConnectionTester.CheckNumberofProcesses().ToString())); }, //Url reach test - invoke the action for updating result to the UI () => { if (ConnectionTester.TestUrl(UrlCheck)) { lblURL.Dispatcher.Invoke(new Action(() => lblURL.Text = "Reachable")); } else { lblURL.Dispatcher.Invoke(new Action(() => lblURL.Text = "Unreachable")); } }, // Path exists test - invoke the action for updating result to the UI () => { if (ConnectionTester.TestDirectory(PathCheck)) { lblDir.Dispatcher.Invoke(new Action(() => lblDir.Text = "Exists")); } else { lblDir.Dispatcher.Invoke(new Action(() => lblDir.Text = "Does not exsist")); } } ); lblRunning.Dispatcher.Invoke(new Action(() => lblRunning.Text = "Done")); //Sleep until next test interval Thread.Sleep(Interval * 1000); } }