示例#1
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();
        }
示例#2
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();
        }
示例#3
0
 private void TxtBoxAgency_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.Key == Key.Up)
         {
             e.Handled = true;
             TxtBoxURL.Focus();
         }
         else if (e.Key == Key.Down)
         {
             e.Handled = true;
             TxtBoxRegion.Focus();
         }
         else if (e.Key == Key.Enter)
         {
             e.Handled = true;
             ButtonAdd.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent));
         }
     }
     catch (Exception)
     {
         LabelMessage.Content = "Error during keyboard navigation.";
     }
 }
示例#4
0
        private void refresh()
        {
            busy = true;
            hosts.Clear();
            checkedSystems.Clear();
            LstBoxBlocked.Items.Clear();

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

            BackWorkerSystemList.RunWorkerAsync();
        }
示例#5
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
     { }
 }