//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);
     }
 }
 //Advanced test seperated to tasks
 private void RunAdvancedTests()
 {
     lblRunning.Dispatcher.Invoke(new Action(() => lblRunning.Text = "Advanced Tests"));
     //Cpu usage test - invoke the action for updating result to the UI and sleep accordnig to user input
     Task.Run(() =>
     {
         while (running)
         {
             lblCpuUsage.Dispatcher.Invoke(new Action(() => lblCpuUsage.Text = ConnectionTester.TestCPUPerformance().ToString() + "%"));
             Thread.Sleep(props.cpuTestInterval * 1000);
         }
     });
     //Ram usage test - invoke the action for updating result to the UI and sleep accordnig to user input
     Task.Run(() =>
     {
         while (running)
         {
             lblRamUsage.Dispatcher.Invoke(new Action(() => lblRamUsage.Text = ConnectionTester.TestRamPerformance().ToString() + "%"));
             Thread.Sleep(props.ramTestInterval * 1000);
         }
     });
     //Processes running test - invoke the action for updating result to the UI and sleep accordnig to user input
     Task.Run(() =>
     {
         while (running)
         {
             lblProcesses.Dispatcher.Invoke(new Action(() => lblProcesses.Text = ConnectionTester.CheckNumberofProcesses().ToString()));
             Thread.Sleep(props.processesTestInterval * 1000);
         }
     });
     //Url reach test - invoke the action for updating result to the UI and sleep accordnig to user input
     Task.Run(() =>
     {
         while (running)
         {
             if (ConnectionTester.TestUrl(UrlCheck))
             {
                 lblURL.Dispatcher.Invoke(new Action(() => lblURL.Text = "Reachable"));
             }
             else
             {
                 lblURL.Dispatcher.Invoke(new Action(() => lblURL.Text = "Unreachable"));
             }
             Thread.Sleep(props.urlTestInterval * 1000);
         }
     });
     //Path exists test - invoke the action for updating result to the UI and sleep accordnig to user input
     Task.Run(() =>
     {
         while (running)
         {
             if (ConnectionTester.TestDirectory(PathCheck))
             {
                 lblDir.Dispatcher.Invoke(new Action(() => lblDir.Text = "Exists"));
             }
             else
             {
                 lblDir.Dispatcher.Invoke(new Action(() => lblDir.Text = "Does not exsist"));
             }
             Thread.Sleep(props.pathTestInterval * 1000);
         }
     });
 }