R
R
Roman2022-04-21 18:28:32
C++ / C#
Roman, 2022-04-21 18:28:32

Loop code in sysharp?

Please help me loop the code:

instance.UseTrafficMonitoring = true;
var traffic = instance.ActiveTab.GetTraffic();
System.Threading.Thread.Sleep(200); //250-350-450
foreach(var t in traffic) {
    if (t.Url.Contains("/search?tbm=map")) {
        return System.Text.Encoding.UTF8.GetString(t.ResponseBody);
        //return System.Text.Encoding.UTF8.GetString(t.ResponseBody, 0, t.ResponseBody.Length);
    }
}
return "0";

Only one option comes to mind, this is a cycle by the number of attempts with a given step in ms until return is not 0. I set a large delay, traffic does not catch, less, it swears with an error. And asking something in the middle is not an option, because. catch errors or omissions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2022-04-21
@rPman

'looping' is a way to solve a problem, and the question should be about the problem itself, otherwise it's completely unclear what you need.
I'm telepathic - you have browser components on the form and for the first one, in which the address will match the specified condition, you need to return the html body of the page?
ps run the specified code without sleep in the method of the Timer component, setting it to the polling interval

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question