private void Web_TitleChanged(object sender, TitleChangedEventArgs e)
{
if (!IsDisposed)
{
Invoke(new Action(() => Text = e.Title));
WebBrowser.TitleChanged -= Web_TitleChanged;
WebBrowser.AddressChanged -= Web_AddressChanged;
}
}
try
{
if (e.Frame.IsMain)
{
await Task.Run(() =>
{
if (AddressBar.Text.Contains("ya")) //проверка на адрес
{
WebBrowser.ExecuteScriptAsync("document.querySelectorAll('#checkbox_panel > span').forEach(function(i){ i.click()})" + ";");
}
});
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Severity Code Description Project File Line Suppression State
Error CS4033 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.