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 FRControl
{
    public partial class Home : Form
    {
        public static string title = "";
        public static string url ="";
        public Home()
        {
            InitializeComponent();
            //this.Icon = Icon.FromHandle(System.IO.Path.GetFullPath(Properties.Settings.Default.iconImg));
                //Icon.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.iconImg));
            Size WindowsScreenSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            Console.WriteLine(WindowsScreenSize);
            int width = Screen.PrimaryScreen.Bounds.Width;
            if (width == 1080)
            {
                this.Size = new Size(1080, 1920);
            }
            else
            {
                this.Size = new Size(608, 1080);
            }
            this.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.bannerUrl));
            this.CaseBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.caseImg));
            this.LawyerBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.lawyerImg));
            this.PersonBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.personImg));
            this.CodePic.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.codeImg));
            this.CloseBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.closeImg));
        }

        private void CaseBtn_Click(object sender, EventArgs e)
        {
            //this.CaseBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.caseImgOn));
            //System.Diagnostics.Process.Start(Properties.Settings.Default.caseInformation);
            //
            WebView webView = new WebView();
            title = Properties.Settings.Default.caseName;
            url = Properties.Settings.Default.lawyerInterview;
            //webView.param = Properties.Settings.Default.caseInformation;
            webView.Show();
        }

        private void LawyerBtn_Click(object sender, EventArgs e)
        {
            //this.LawyerBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.lawyerImgOn));
            //System.Diagnostics.Process.Start(Properties.Settings.Default.lawyerInterview);
            WebView webView = new WebView();
            title = Properties.Settings.Default.lawyerName;
            url = Properties.Settings.Default.caseInformation;
            //webView.param = Properties.Settings.Default.caseInformation;
            webView.Show();
        }

        private void PersonBtn_Click(object sender, EventArgs e)
        {
            //this.PersonBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.personImgOn));
            //System.Diagnostics.Process.Start(Properties.Settings.Default.personInterview);
            WebView webView = new WebView();
            title = Properties.Settings.Default.personName;
            url = Properties.Settings.Default.personInterview;
            //webView.param = Properties.Settings.Default.caseInformation;
            webView.Show();
        }

        private void CaseBtn_Hover(object sender, EventArgs e)
        {
            this.CaseBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.caseImgOn));
          
        }

        private void CaseBtn_Leave(object sender, EventArgs e)
        {
            this.CaseBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.caseImg));

        }

        private void LawyerBtn_Hover(object sender, EventArgs e)
        {
            this.LawyerBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.lawyerImgOn));

        }

        private void LawyerBtn_Leave(object sender, EventArgs e)
        {
            this.LawyerBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.lawyerImg));

        }

        private void PersonBtn_Hover(object sender, EventArgs e)
        {
            this.PersonBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.personImgOn));

        }

        private void PersonBtn_Leave(object sender, EventArgs e)
        {
            this.PersonBtn.BackgroundImage = Image.FromFile(System.IO.Path.GetFullPath(Properties.Settings.Default.personImg));

        }

        private void close_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Home_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Q) && e.Control)       
                this.Close();
        }

        private void CloseBtn_Click(object sender, EventArgs e)
        {                 

        }

        private void CloseBtn_MouseDown(object sender, MouseEventArgs e)
        {
            timer1.Interval = 3000;//timer1_Tick那段代码每3秒执行一次，初始执行，在3秒之后才正式开始
            timer1.Enabled = true;//开启timer3

        }

        private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
