private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e) { bool naqOborVPonuke = false; if (!string.IsNullOrEmpty(webBrowser1.StatusText) && _pocetLoad == 0 && !webBrowser1.StatusText.Contains("obchod.php?page=6")) { var elements = webBrowser1.Document.Body.GetElementsByTagName("input").GetElementsByName("pl_koupit"); foreach (HtmlElement element in elements) { element.SetAttribute("onclick", "return true"); } _listPlanet = _jadro.ParsujPlanetyObchod(webBrowser1.Document.Window.Document.Body.InnerHtml); dataGridView1.DataSource = null; dataGridView1.DataSource = _listPlanet; _pocetLoad = 1; if (webBrowser1.Document.Body.InnerText.Contains("Byla koupena")) { ZastavRefresh(); _poc++; } else { //_refreshovaciCas = 1; } if (_poc == 1) { bool akcia = _jadro.CheckKupuPlanety(_listPlanet, textBoxCena.Text); var list = _listPlanet; if (akcia) { var ind = _jadro.VypocitajSkore(list); HtmlElement element; if (checkBoxObry.Checked) { var index = list.FindIndex(item => item.Typ.Contains("Naquadahový obr")); if (index == -1) { index = ind; naqOborVPonuke = true; } element = webBrowser1.Document.Body.GetElementsByTagName("input").GetElementsByName("pl_koupit")[index * 2 + 1]; } else { element = webBrowser1.Document.Body.GetElementsByTagName("input").GetElementsByName("pl_koupit")[ind * 2 + 1]; } int vystx; int vysty; webBrowser1.Document.Window.ScrollTo(getXoffset(element, out vystx), getYoffset(element, out vysty) + vysty / 5); var fmx = webBrowser1.Parent.Location.X; var fmy = webBrowser1.Parent.Location.Y; var wbx = webBrowser1.Location.X; vystx = 50 + element.Parent.OffsetRectangle.X + element.Parent.Parent.OffsetRectangle.X /* + (element.Parent.OffsetRectangle.X*2 + element.Parent.Parent.OffsetRectangle.Width) / 2*/ + element.Parent.Parent.OffsetRectangle.Width / 2; vysty = element.OffsetRectangle.Y; var x = vystx + fmx + wbx; var y = vysty + fmy + SystemInformation.CaptionHeight + 55;//+ 75; TopMost = true; if (_uloz == 0) { Console.WriteLine(@"Ukladanie"); LogHelper.UlozPlanetyObchod(_listPlanet); _uloz = 1; } // DoMouseClick(65535 / Screen.PrimaryScreen.WorkingArea.Size.Width * (Screen.PrimaryScreen.WorkingArea.Size.Width / 2 + 540), 65535 / Screen.PrimaryScreen.WorkingArea.Size.Height * (285 + ind * 100 - ind * 4)); if ((checkBox1.Checked && !checkBoxIbaObry.Checked) || (checkBox1.Checked && checkBoxIbaObry.Checked && naqOborVPonuke)) { var screenBounds = Screen.PrimaryScreen.Bounds; if (!checkBoxSuradnice.Checked && !checkBoxSuradniceRelativne.Checked) { DoMouseClick(x * 65535 / screenBounds.Width, y * 65535 / screenBounds.Height); } else { if (checkBoxSuradnice.Checked) { if (!string.IsNullOrEmpty(textBoxPoziciaX.Text) && !string.IsNullOrEmpty(textBoxPoziciaY.Text)) { DoMouseClick(int.Parse(textBoxPoziciaX.Text) * 65535 / screenBounds.Width, int.Parse(textBoxPoziciaY.Text) * 65535 / screenBounds.Height); } } if (checkBoxSuradniceRelativne.Checked) { if (!string.IsNullOrEmpty(textBoxRelatX.Text) && !string.IsNullOrEmpty(textBoxRelatY.Text)) { DoMouseClick((int.Parse(textBoxRelatX.Text) + x) * 65535 / screenBounds.Width, (int.Parse(textBoxRelatY.Text) + y) * 65535 / screenBounds.Height); } } } //_poc++; } //_refreshovaciCas = 1; } } } }