using Percent___Qualification_work.Classes;
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 Percent___Qualification_work.Forms
{
    public partial class main : Form
    {
        Timer slideTimer = new Timer();
        bool isSlidingUp = false;   
        bool isSlidingDown = false; 
        int targetHeight = 0;       
        int slideSpeed = 10;        

        public main()
        {
            InitializeComponent();


            slideTimer.Interval = 20; 
            slideTimer.Tick += new EventHandler(SlideNavbar);

            targetHeight = navbarPanel.Height;  
            navbarPanel.Height = 0;

            Load += main_Load;

        }

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

        
        private void hideButton_Click(object sender, EventArgs e)
        {
            if (navbarPanel.Height > 0)  
            {
                isSlidingUp = true;
                isSlidingDown = false;
                slideTimer.Start();  
            }
        }

        
        private void showButton_Click_1(object sender, EventArgs e)
        {
            if (navbarPanel.Height == 0)  
            {
                isSlidingUp = false;
                isSlidingDown = true;
                slideTimer.Start();  
            }
        }

        
        private void SlideNavbar(object sender, EventArgs e)
        {
            
            if (isSlidingUp && navbarPanel.Height > 0)
            {
                navbarPanel.Height -= slideSpeed;  
                if (navbarPanel.Height <= 0)
                {
                    navbarPanel.Height = 0;        
                    slideTimer.Stop();             
                }
            }
            
            else if (isSlidingDown && navbarPanel.Height < targetHeight)
            {
                navbarPanel.Height += slideSpeed;  
                if (navbarPanel.Height >= targetHeight)
                {
                    navbarPanel.Height = targetHeight; 
                    slideTimer.Stop();                 
                }
            }
        }

        private void hideButton_Click_1(object sender, EventArgs e)
        {
            if (navbarPanel.Height > 0)  
            {
                isSlidingUp = true;
                isSlidingDown = false;
                slideTimer.Start();  
            }
        }

        private void todoBtn_Click(object sender, EventArgs e)
        {

        }

        public void SetActivePanel(UserControl control)
        {
            home1.Visible = false;
            toDo1.Visible = false;
            notepad1.Visible = false;
            gameList1.Visible = false;
            movieList1.Visible = false;
            profile1.Visible = false;

            control.Visible = true;
        }
    }
}
