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

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

        private void label1_Click(object sender, EventArgs e)
        {

        }

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

        private void Filter_Duration_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            
            string Duration=Durationtxt.Value.ToString();
            
            if (TypeCmb.Text == "Minutes")
                Duration = (Durationtxt.Value * 60).ToString();
            else if(TypeCmb.Text=="Hours")
                Duration = (Durationtxt.Value * 120).ToString();

            if (LessRb.Checked)
                Duration = ">" + Duration;
            else
                Duration = "<" + Duration;

            
            TreeNode[] filtered_node = functions.Filter_Greater_Less_duration(Filtertree.Nodes[0].Nodes[3], 223, Duration, 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();
        }
    }
}
