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 FilterIMEI : Form
    {

        TreeView Filtertree;
        string filename;
        List<functions.Changes> Changes;
        public FilterIMEI()
        {
            InitializeComponent();
        }

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

        public void TreeNode(TreeView Filtertreenode, string Opened_filename, List<functions.Changes> ChangesList)
        {
            Filtertree = Filtertreenode;
            filename = Opened_filename;
            Changes = ChangesList;
        }

        private void FilterIMEI_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (IMSItxt.Text != "")
            {
                TreeNode[] filtered_node = functions.Filter_by_identifier(Filtertree.Nodes[0].Nodes[3], 129, IMSItxt.Text, filename,Changes);
                if (filtered_node.Length > 0)
                {
                    Filtertree.Nodes[0].Nodes[3].Nodes.Clear();
                    Filtertree.Nodes[0].Nodes[3].Nodes.AddRange(filtered_node);
                }
            }
            if (IMEItxt.Text != "")
            {
                TreeNode[] filtered_node = functions.Filter_by_identifier(Filtertree.Nodes[0].Nodes[3], 128, IMEItxt.Text, filename,Changes);
                if (filtered_node.Length > 0)
                {
                    Filtertree.Nodes[0].Nodes[3].Nodes.Clear();
                    Filtertree.Nodes[0].Nodes[3].Nodes.AddRange(filtered_node);
                }
            }
            this.Hide();
        }
    }
}
