private async Task UpdateCell(DataGridViewCell cell) { cell.Style.BackColor = System.Drawing.Color.OrangeRed; if (!string.IsNullOrEmpty(cell.ErrorText)) { string server = cmbServer.Text; var res = await Task.Run(() => WhoisHelper.WhoisExtension(cell.OwningRow, cell.OwningColumn.HeaderText.Substring(1), server)); SetCellStyle(res); } }
public static WhoisInfo WhoisExtension(DataGridViewRow row, string extension, string server) { if (extension.Equals("ir", StringComparison.OrdinalIgnoreCase)) { server = "whois.nic.ir"; } var whois = new WhoisHelper(); var res = whois.WhoiseCheckState(row.Cells[0].Value.ToString(), extension, server, false); res.Cell = row.Cells[extension]; return(res); }
private async void btnLookUp_Click(object sender, EventArgs e) { try { InvokeIfRequire(() => dgvResult.Rows.Clear()); _cts = new CancellationTokenSource(); btnPreCompile.PerformClick(); InvokeIfRequire(() => lblNamesCounter.Text = _hostNames.Length.ToString()); UiActivation(false); if (_hostNames.Length == 0 || _selectedExtensions.Count == 0) { return; } InvokeIfRequire(() => progResult.Maximum = _hostNames.Length * _selectedExtensions.Count); IncreaseProgress(true); // add domains to grid UI Thread Cursor = Cursors.WaitCursor; foreach (var url in _hostNames) { if (_cts.IsCancellationRequested) { return; } dgvResult.Rows.Add(url); } Cursor = Cursors.Default; var server = cmbServer.Text; var tasks = new List <Task>(); var lstRows = dgvResult.Rows.Cast <DataGridViewRow>().ToList(); WhoisHelper.Progress += WhoisHelper_Progress; await WhoisHelper.WhoisParallel(lstRows, _selectedExtensions, server, _cts); } finally { InvokeIfRequire(() => progResult.Value = progResult.Maximum); MessageBox.Show("Whois Completed"); UiActivation(true); } }
public static WhoisInfo WhoisExtension(DataGridViewRow row, string extension, string server) { if (extension.Equals("ir", StringComparison.OrdinalIgnoreCase)) { server = "whois.nic.ir"; } var whois = new WhoisHelper(); var res = whois.WhoiseCheckState(row.Cells[0].Value.ToString(), extension, server, false); res.Cell = row.Cells[extension]; return res; }