using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using AnalogClockControl;

namespace Apple_Software
{
    public partial class MFApple : Form
    {
        public MFApple()
        {
            InitializeComponent();
        }

        public static int si = 0;
        private void MFTime_Tick(object sender, EventArgs e)
        {
            DateTime Time = DateTime.Now;
            PersianCalendar ps = new PersianCalendar();
            LTime.Text = string.Format("|  {2} : {1} : {0}  | ", ps.GetHour(Time), ps.GetMinute(Time), ps.GetSecond(Time));
        }

        private void MFName_Tick(object sender, EventArgs e)
        {
            try
            {
                string Lstr = "Apple Software     ";
                if (this.Text.ToString().Length < Lstr.Length)
                {
                    this.Text = Lstr.Substring(0, si) + "_";
                    si += 1;
                }
                else
                {
                    this.Text = "";
                    si = 0;
                }
            }
            catch { }
        }

        private void MFApple_Load(object sender, EventArgs e)
        {
            LData.Text = Data.Persian() + " |";
            LData1.Text = Data.English() + " |";
            User.Text = "کاربر فعال : " + AFEnter.User.ToString() + " |";
            AnalogClock Clock = new AnalogClock();
            Clock.Start();
        }

        private void MFApple_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void M1_Click(object sender, EventArgs e)
        {
            AFPAdd AFPAdd = new AFPAdd();
            AFPAdd.Show();
        }

        private void M2_Click(object sender, EventArgs e)
        {
            AFKAdd AFKAdd = new AFKAdd();
            AFKAdd.Show();
        }

        private void M3_Click(object sender, EventArgs e)
        {
            AFWAdd AFWAdd = new AFWAdd();
            AFWAdd.Show();
        }

        private void M4_Click(object sender, EventArgs e)
        {
            AFEnter AFEnter = new AFEnter();
            AFEnter.Show();
            this.Hide();
        }

        private void M5_Click(object sender, EventArgs e)
        {
            close.Form(this);
        }

        private void N1_Click(object sender, EventArgs e)
        {
            if (MfSS.Visible == true)
                MfSS.Visible = false;
            else
                MfSS.Visible = true;
        }

        private void N2_Click(object sender, EventArgs e)
        {
            if (LData.Visible == true)
                LData.Visible = false;
            else
                LData.Visible = true;
        }

        private void N3_Click(object sender, EventArgs e)
        {
            if (LData1.Visible == true)
                LData1.Visible = false;
            else
                LData1.Visible = true;
        }

        private void N4_Click(object sender, EventArgs e)
        {
            if (User.Visible == true)
                User.Visible = false;
            else
                User.Visible = true;
        }

        private void N7_Click(object sender, EventArgs e)
        {
            if (LTime.Visible == true)
                LTime.Visible = false;
            else
                LTime.Visible = true;
        }

        private void N5_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("Calc.exe");
        }

        private void N6_1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ODI = new OpenFileDialog();
            ODI.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            ODI.Filter = "Picture As jpg|*.jpg|Picture As jpeg|*.jpeg*|Picture As bmp|*.bmp|Picture As gif|*.gif|Picture As wmf|*.wmf|Picture As png|*.png";

            if (ODI.ShowDialog(this) == DialogResult.OK)
            {
                pictureBox1.ImageLocation = ODI.FileName;
            }
        }

        private void N6_2_Click(object sender, EventArgs e)
        {
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            N6_2.Checked = true;
            N6_3.Checked = false;
            N6_4.Checked = false;
        }

        private void N6_3_Click(object sender, EventArgs e)
        {
            pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
            N6_2.Checked = false;
            N6_3.Checked = true;
            N6_4.Checked = false;
        }

        private void N6_4_Click(object sender, EventArgs e)
        {
            pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
            N6_2.Checked = false;
            N6_3.Checked = false;
            N6_4.Checked = true;
        }

        private void O1_Click(object sender, EventArgs e)
        {
            AFHWEnter AFHWEnter = new AFHWEnter();
            AFHWEnter.Show();
        }

        private void O2_Click(object sender, EventArgs e)
        {
            AFDHWEnter AFDHWEnter = new AFDHWEnter();
            AFDHWEnter.Show();
        }

        private void O3_Click(object sender, EventArgs e)
        {
            AFPKW AFPKW = new AFPKW();
            DetectForm.F = 9;
            AFPKW.Show();
        }

        private void O4_Click(object sender, EventArgs e)
        {
            AFPKW AFPKW = new AFPKW();
            DetectForm.F = 7;
            AFPKW.Show();
        }

        private void P1_Click(object sender, EventArgs e)
        {
            AFPKW AFPKW = new AFPKW();
            DetectForm.F = 3;
            AFPKW.Show();
        }

        private void P2_Click(object sender, EventArgs e)
        {
            AFPKW AFPKW = new AFPKW();
            DetectForm.F = 4;
            AFPKW.Show();
        }

        private void P3_Click(object sender, EventArgs e)
        {
            AFPKW AFPKW = new AFPKW();
            DetectForm.F = 5;
            AFPKW.Show();
        }

        private void Q1_Click(object sender, EventArgs e)
        {
            AFCP AFCP = new AFCP();
            AFCP.Show(); 
        }

        private void Q2_Click(object sender, EventArgs e)
        {
            AFPKW AFPKW = new AFPKW();
            DetectForm.F = 6;
            AFPKW.Show();
        }

        private void U1_Click(object sender, EventArgs e)
        {
            AFHWEnter AFHWEnter = new AFHWEnter();
            AFHWEnter.Show();
        }

        private void U2_Click(object sender, EventArgs e)
        {
            AFDHWEnter AFDHWEnter = new AFDHWEnter();
            AFDHWEnter.Show();
        }

        private void U3_Click(object sender, EventArgs e)
        {
            AFPKW AFPKW = new AFPKW();
            DetectForm.F = 9;
            AFPKW.Show();
        }

        private void U4_Click(object sender, EventArgs e)
        {
            AFPKW AFPKW = new AFPKW();
            DetectForm.F = 7;
            AFPKW.Show();
        }

        private void U5_Click(object sender, EventArgs e)
        {
            AFPKW AFPKW = new AFPKW();
            DetectForm.F = 6;
            AFPKW.Show();
        }

        private void U6_Click(object sender, EventArgs e)
        {
            AFEnter AFEnter = new AFEnter();
            AFEnter.Show();
            this.Hide();
        }

        private void U8_Click(object sender, EventArgs e)
        {
            close.Form(this);
        }

        private void U7_1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ODI = new OpenFileDialog();
            ODI.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            ODI.Filter = "Picture As jpg|*.jpg|Picture As jpeg|*.jpeg*|Picture As bmp|*.bmp|Picture As gif|*.gif|Picture As wmf|*.wmf|Picture As png|*.png";

            if (ODI.ShowDialog(this) == DialogResult.OK)
            {
                pictureBox1.ImageLocation = ODI.FileName;
            }
        }

        private void U7_2_Click(object sender, EventArgs e)
        {
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            N6_2.Checked = true;
            N6_3.Checked = false;
            N6_4.Checked = false;
        }

        private void U7_3_Click(object sender, EventArgs e)
        {
            pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
            N6_2.Checked = false;
            N6_3.Checked = true;
            N6_4.Checked = false;
        }

        private void U7_4_Click(object sender, EventArgs e)
        {
            pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
            N6_2.Checked = false;
            N6_3.Checked = false;
            N6_4.Checked = true;
        }

        private void MFApple_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue.ToString() == "27")
                M4_Click(sender, e);
        }      
    }
}
