I cannot think of the best way to achieve this, what I'm trying to do is make my foreach loop stop until a button is clicked, once the button is clicked we then move on to the next value in the foreach loop.
Foreach:
foreach (string site in sites)
{
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
browser = new ChromiumWebBrowser(site);
browser.AddressChanged += OnBrowserAddressChanged;
panelBrowserMain.Controls.Add(browser);
browser.Dock = DockStyle.Fill;
browserMain.Text = site;
// PAUSE HERE UNTIL WE DO WORK IN THE BROWSER, THEN ONCE "NEXT" IS PRESSED MOVE ON TO THE NEXT URL UNTILL THERE IS NO MORE TO PROCESS //
}
I'm thinking set a bool to false, then await a method (which will return true, so we can move on) then set it to false again (once looped) would this be the best way to go about this, or is there a better way?