private void BtnAdd_Click(object sender, EventArgs e) { List <string> newURLs = ProcessURLs( TxtBoxURL.Text.Split( new string[] { Environment.NewLine }, StringSplitOptions.None ) ); foreach (string url in newURLs) { if (url == null || url == "" || url.Length <= 1) { continue; } bool exists = false; foreach (object existingURL in LstBoxBlocked.Items) { if (existingURL.ToString().Contains(url)) { exists = true; } } if (exists) { continue; } LstBoxBlocked.Items.Add(url); } TxtBoxURL.Clear(); }
private void BtnRemove_Click(object sender, EventArgs e) { List <string> toRemove = ProcessURLs( TxtBoxURL.Text.Split( new string[] { Environment.NewLine }, StringSplitOptions.None ) ); List <string> exists = new List <string>(); foreach (object url in LstBoxBlocked.Items) { if (toRemove.Contains(url.ToString())) { exists.Add(url.ToString()); } } if (exists.Count == 0) { return; } foreach (string url in exists) { LstBoxBlocked.Items.RemoveAt( LstBoxBlocked.Items.IndexOf(url) ); } TxtBoxURL.Clear(); }
private void refresh() { busy = true; hosts.Clear(); checkedSystems.Clear(); LstBoxBlocked.Items.Clear(); systemList.Clear(); TxtBoxURL.Clear(); BackWorkerSystemList.RunWorkerAsync(); }
private void LstBoxBlocked_Click(object sender, EventArgs e) { try { TxtBoxURL.Clear(); foreach (string item in LstBoxBlocked.SelectedItems) { TxtBoxURL.AppendText(Environment.NewLine + item); } TxtBoxURL.Text = TrimStart(TxtBoxURL.Text, Environment.NewLine); } catch { } }