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 emlakOtomasyonu
{
    public partial class frmAna : Form
    {
        public frmAna()
        {
            InitializeComponent();
        }

        // FORM TANIMLAMALARI
        frmHakkinda frmHakkinda = new frmHakkinda();
        frmSatilikKonut frmSatilikKonut = new frmSatilikKonut();
        frmMusterilerAlici frmMusterilerAlici = new frmMusterilerAlici();
        frmMusterilerSatici frmMusterilerSatici = new frmMusterilerSatici();
        frmKullanicilar frmKullanicilar = new frmKullanicilar();
        frmSatilikIsyeri frmSatilikIsyeri = new frmSatilikIsyeri();
        frmSatilikArsa frmSatilikArsa = new frmSatilikArsa();
        frmKiralikKonut frmKiralikKonut = new frmKiralikKonut();
        frmKiralikIsyeri frmKiralikIsyeri = new frmKiralikIsyeri();
        frmArama frmArama = new frmArama();
        // ! FORM TANIMLAMALARI
        private void hakkındaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmHakkinda.Created)
            {
                frmHakkinda.Activate();
                frmHakkinda.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmHakkinda = new frmHakkinda();
                frmHakkinda.MdiParent = this;
                frmHakkinda.Show();
            }
        }

        private void anaForm_Load(object sender, EventArgs e)
        {
            lblTarihSaat.Text = DateTime.Now.ToLongDateString() + " | " + DateTime.Now.ToLongTimeString();
            this.MinimumSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            this.MaximumSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            lblTarihSaat.Text = DateTime.Now.ToLongDateString() + " | " + DateTime.Now.ToLongTimeString();
        }

        private void konutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmSatilikKonut.Created)
            {
                frmSatilikKonut.Activate();
                frmSatilikKonut.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmSatilikKonut = new frmSatilikKonut();
                frmSatilikKonut.MdiParent = this;
                frmSatilikKonut.Show();
            }
        }

        private void satıcıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmMusterilerSatici.Created)
            {
                frmMusterilerSatici.Activate();
                frmMusterilerSatici.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmMusterilerSatici = new frmMusterilerSatici();
                frmMusterilerSatici.MdiParent = this;
                frmMusterilerSatici.Show();
            }
        }

        private void alıcıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmMusterilerAlici.Created)
            {
                frmMusterilerAlici.Activate();
                frmMusterilerAlici.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmMusterilerAlici = new frmMusterilerAlici();
                frmMusterilerAlici.MdiParent = this;
                frmMusterilerAlici.Show();
            }
        }

        private void frmAna_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.Exit();
        }

        private void kullanıcılarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmKullanicilar.Created)
            {
                frmKullanicilar.Activate();
                frmKullanicilar.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmKullanicilar = new frmKullanicilar();
                frmKullanicilar.MdiParent = this;
                frmKullanicilar.Show();
            }
        }

        private void işyeriToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmSatilikIsyeri.Created)
            {
                frmSatilikIsyeri.Activate();
                frmSatilikIsyeri.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmSatilikIsyeri = new frmSatilikIsyeri();
                frmSatilikIsyeri.MdiParent = this;
                frmSatilikIsyeri.Show();
            }
        }

        private void arsaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmSatilikArsa.Created)
            {
                frmSatilikArsa.Activate();
                frmSatilikArsa.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmSatilikArsa = new frmSatilikArsa();
                frmSatilikArsa.MdiParent = this;
                frmSatilikArsa.Show();
            }
        }

        private void konutToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (frmKiralikKonut.Created)
            {
                frmKiralikKonut.Activate();
                frmKiralikKonut.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmKiralikKonut = new frmKiralikKonut();
                frmKiralikKonut.MdiParent = this;
                frmKiralikKonut.Show();
            }
        }

        private void işyeriToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (frmKiralikIsyeri.Created)
            {
                frmKiralikIsyeri.Activate();
                frmKiralikIsyeri.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmKiralikIsyeri = new frmKiralikIsyeri();
                frmKiralikIsyeri.MdiParent = this;
                frmKiralikIsyeri.Show();
            }
        }

        private void aramaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmArama.Created)
            {
                frmArama.Activate();
                frmKiralikIsyeri.WindowState = FormWindowState.Normal;
            }
            else
            {
                frmArama = new frmArama();
                frmArama.MdiParent = this;
                frmArama.Show();
            }
        }

        private void frmAna_LocationChanged(object sender, EventArgs e)
        {
            this.Location = new Point(0, 0);
        }

        private void çıkışToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        //void formAc (Form frm)
        //{
        //    if (frm.Created)
        //    {
        //        frm.Activate();
        //        frm.WindowState = FormWindowState.Normal;
        //    }
        //    else
        //    {
        //        frm = new frmSatilikArsa();
        //        frm.MdiParent = this;
        //        frm.Show();
        //    }
        //}
    }
}
