Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        private void refresh()
        {
            busy = true;
            hosts.Clear();
            checkedSystems.Clear();
            LstBoxBlocked.Items.Clear();

            systemList.Clear();
            TxtBoxURL.Clear();

            BackWorkerSystemList.RunWorkerAsync();
        }
Exemplo n.º 4
0
 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
     { }
 }