using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BulkTap3
{
    public partial class Filterbyevent : Form
    {
        TreeView Filtertree;
        TreeNode alltreenode;
        public Filterbyevent()
        {
            InitializeComponent();
        }

        private void Filterbyevent_Load(object sender, EventArgs e)
        {
            
        }

        public void TreeNode(TreeView Filtertreenode,TreeNode allnodes)
        {
            Filtertree = Filtertreenode;
            alltreenode = allnodes;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void button1_Click(object sender, EventArgs e)
        {
                      /*indlenV == 9  ||
                        indlenV == 10 ||
                        indlenV == 11 ||
                        indlenV == 12 ||
                        indlenV == 14 ||
                        indlenV == 17 ||
                        indlenV == 297||
                        indlenV == 433||
                        indlenV == 434*/
            if (Filter_cb1.Checked)
            {
                TreeNode[] a = Filtertree.Nodes.Find("9", true);
                for (int count = 0; count < a.Length; count++)
                {
                    Filtertree.Nodes.Remove(a[count]);
                }
            }
            if (Filter_cb2.Checked)
            {
                TreeNode[] a = Filtertree.Nodes.Find("10", true);
                for (int count = 0; count < a.Length; count++)
                {
                    Filtertree.Nodes.Remove(a[count]);
                }
            }
            if (Filter_cb3.Checked)
            {
                TreeNode[] a = Filtertree.Nodes.Find("11", true);
                for (int count = 0; count < a.Length; count++)
                {
                    Filtertree.Nodes.Remove(a[count]);
                }
            }
            if (Filter_cb4.Checked)
            {
                TreeNode[] a = Filtertree.Nodes.Find("12", true);
                for (int count = 0; count < a.Length; count++)
                {
                    Filtertree.Nodes.Remove(a[count]);
                }
            }
            if (Filter_cb5.Checked)
            {
                TreeNode[] a = Filtertree.Nodes.Find("14", true);
                for (int count = 0; count < a.Length; count++)
                {
                    Filtertree.Nodes.Remove(a[count]);
                }
            }
            if (Filter_cb6.Checked)
            {
                TreeNode[] a = Filtertree.Nodes.Find("17", true);
                for (int count = 0; count < a.Length; count++)
                {
                    Filtertree.Nodes.Remove(a[count]);
                }
            }
            if (Filter_cb7.Checked)
            {
                TreeNode[] a = Filtertree.Nodes.Find("297", true);
                for (int count = 0; count < a.Length; count++)
                {
                    Filtertree.Nodes.Remove(a[count]);
                }
            }
            if (Filter_cb8.Checked)
            {
                TreeNode[] a = Filtertree.Nodes.Find("433", true);
                for (int count = 0; count < a.Length; count++)
                {
                    Filtertree.Nodes.Remove(a[count]);
                }
            }
            if (Filter_cb9.Checked)
            {
                TreeNode[] a = Filtertree.Nodes.Find("434", true);
                for (int count = 0; count < a.Length; count++)
                {
                    Filtertree.Nodes.Remove(a[count]);
                }
            }
            //Filtertree.Visible = true;
            if (!Filter_cb1.Checked
                && !Filter_cb2.Checked
                && !Filter_cb3.Checked
                && !Filter_cb4.Checked
                && !Filter_cb5.Checked
                && !Filter_cb6.Checked
                && !Filter_cb7.Checked
                && !Filter_cb8.Checked
                && !Filter_cb9.Checked)
            {
                Filtertree.Nodes.Clear();
                Filtertree.Nodes.Add(alltreenode);
            }
            this.Hide();
        }
    }
}
