0
I’m creating an app, where it has a Webview that needs to be updated every 5 seconds while the Switch is checked, and when you uncheck it, it should stop loading the page.
I tried to use a while, but the application is waiting for the while and during that it freezes, if you can help me with this problem I will be very grateful!
My current code:
nswtURL.Click += delegate
                {
                    if (nswtURL.Checked)
                    {
                        //true
                        nWebView.LoadUrl(URL);
                        while(nswtCamera.Checked)
                        {
                            nWebView.Reload();
                            Thread.Sleep(5);
                        }
                    }
                    else
                    {
                        //false
                        nWebView.StopLoading();
                    }
                };