using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Configuration;
using System.Data;

namespace KelimeEzber
{
	/// <summary>
	/// Summary description for KelimeEzber.
	/// </summary>
	public class MainForm_KelimeEzber : System.Windows.Forms.Form
	{
		private System.Windows.Forms.MainMenu mainMenu1;
		public System.Windows.Forms.MenuItem menuItem_Sistem;
		public System.Windows.Forms.MenuItem menuItem_DataGiris;
		public System.Windows.Forms.MenuItem menuItem_ExitProgram;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.NotifyIcon notifyIcon1;
		private System.Windows.Forms.ContextMenu contextMenu1;
		private System.Windows.Forms.MenuItem menuItem10;
		private System.Windows.Forms.MenuItem menuItem11;
		private System.Windows.Forms.MenuItem menuItem12;
		private System.Windows.Forms.MenuItem menuItem13;
		private System.ComponentModel.IContainer components;

		public MainForm_KelimeEzber()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new MainForm_KelimeEzber());
		}
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm_KelimeEzber));
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuItem_Sistem = new System.Windows.Forms.MenuItem();
			this.menuItem13 = new System.Windows.Forms.MenuItem();
			this.menuItem_DataGiris = new System.Windows.Forms.MenuItem();
			this.menuItem_ExitProgram = new System.Windows.Forms.MenuItem();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.menuItem12 = new System.Windows.Forms.MenuItem();
			this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
			this.contextMenu1 = new System.Windows.Forms.ContextMenu();
			this.menuItem10 = new System.Windows.Forms.MenuItem();
			this.menuItem11 = new System.Windows.Forms.MenuItem();
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem_Sistem,
																					  this.menuItem1,
																					  this.menuItem12});
			// 
			// menuItem_Sistem
			// 
			this.menuItem_Sistem.Index = 0;
			this.menuItem_Sistem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																							this.menuItem13,
																							this.menuItem_DataGiris,
																							this.menuItem_ExitProgram});
			this.menuItem_Sistem.Text = "&Sistem";
			// 
			// menuItem13
			// 
			this.menuItem13.Index = 0;
			this.menuItem13.Text = "&Genel Ayarlar";
			this.menuItem13.Click += new System.EventHandler(this.menuItem13_Click);
			// 
			// menuItem_DataGiris
			// 
			this.menuItem_DataGiris.Index = 1;
			this.menuItem_DataGiris.Text = "&Data Giriş";
			this.menuItem_DataGiris.Click += new System.EventHandler(this.menuItem_DataGiris_Click);
			// 
			// menuItem_ExitProgram
			// 
			this.menuItem_ExitProgram.Index = 2;
			this.menuItem_ExitProgram.Text = "Çı&kış";
			this.menuItem_ExitProgram.Click += new System.EventHandler(this.menuItem_ExitProgram_Click);
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 1;
			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem5,
																					  this.menuItem2,
																					  this.menuItem3,
																					  this.menuItem4});
			this.menuItem1.Text = "&Aktiviteler";
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.Text = "&Kelime Tekrar";
			this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.Text = "K&elime Bulma Oyunu";
			this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 3;
			this.menuItem4.Text = "Ç&apraz Bulmaca";
			this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 0;
			this.menuItem5.Text = "Söz&lük";
			this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
			// 
			// menuItem12
			// 
			this.menuItem12.Index = 2;
			this.menuItem12.Text = "&Hakkında";
			this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
			// 
			// notifyIcon1
			// 
			this.notifyIcon1.ContextMenu = this.contextMenu1;
			this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
			this.notifyIcon1.Text = "";
			this.notifyIcon1.Visible = true;
			this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
			// 
			// contextMenu1
			// 
			this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItem10,
																						 this.menuItem11});
			// 
			// menuItem10
			// 
			this.menuItem10.Index = 0;
			this.menuItem10.Text = "&Ana Pencere";
			this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
			// 
			// menuItem11
			// 
			this.menuItem11.Index = 1;
			this.menuItem11.Text = "Çıkış";
			this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click);
			// 
			// MainForm_KelimeEzber
			// 
			this.AllowDrop = true;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(752, 569);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.IsMdiContainer = true;
			this.KeyPreview = true;
			this.Menu = this.mainMenu1;
			this.Name = "MainForm_KelimeEzber";
			this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Kelime Ezber Projesi";
			this.TopMost = true;
			this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.KelimeEzber_KeyPress);
			this.Load += new System.EventHandler(this.KelimeEzber_Load);
			this.Closed += new System.EventHandler(this.MainForm_KelimeEzber_Closed);
			this.Activated += new System.EventHandler(this.MainForm_KelimeEzber_Activated);
			this.TextChanged += new System.EventHandler(this.MainForm_KelimeEzber_TextChanged);

		}
		#endregion

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

		private void KelimeEzber_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (e.KeyChar == 27) 
			{
				General.GenelAyarlar myAyarlar = new KelimeEzber.General.GenelAyarlar();
				if (myAyarlar.bSystemTraydaGoster) 
				{
					this.Visible=false;
					this.ShowInTaskbar=false;
				} 
				else 
				{
					DialogResult dr = MessageBox.Show("Uygulamada çıkmak istediğinizden emin misiniz?","Çıkış",
						MessageBoxButtons.YesNo,MessageBoxIcon.Information);
					if(Convert.ToString(dr)=="Yes")
					{
						notifyIcon1.Visible=false;
						this.Close();
						return;
					}
					this.WindowState=FormWindowState.Minimized;
				}
				myAyarlar.Dispose();
				myAyarlar = null;
			}
		}

		private void KelimeEzber_Load(object sender, System.EventArgs e)
		{
			this.notifyIcon1.Text = this.Text;
		}

		private void menuItem_DataGiris_Click(object sender, System.EventArgs e)
		{
			Form_DataGiris yeniWindow = new Form_DataGiris();
			yeniWindow.MdiParent = this;
			yeniWindow.Show();
		}

		private void menuItem10_Click(object sender, System.EventArgs e)
		{
			this.WindowState=FormWindowState.Normal;
			this.Visible=true;
			this.ShowInTaskbar=true;
		}

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

		private void menuItem12_Click(object sender, System.EventArgs e)
		{
			Form_Hakkinda yeniWindow = new Form_Hakkinda();
			yeniWindow.MdiParent = this;
			yeniWindow.Show();
		}

		private void menuItem2_Click(object sender, System.EventArgs e)
		{
			Form_KelimeTekrar yeniWindow = new Form_KelimeTekrar();
			yeniWindow.MdiParent = this;
			yeniWindow.Show();
		}

		private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
		{
			this.Visible=true;
			this.ShowInTaskbar=true;
		}

		private void MainForm_KelimeEzber_Closed(object sender, System.EventArgs e)
		{
			this.notifyIcon1.Visible=false;
		}

		private void menuItem3_Click(object sender, System.EventArgs e)
		{
			Form_KelimeBulma yeniWindow = new Form_KelimeBulma();
			yeniWindow.MdiParent = this;
			yeniWindow.Show();
		}

		private void MainForm_KelimeEzber_Activated(object sender, System.EventArgs e)
		{
			General.DataManager myDm = new KelimeEzber.General.DataManager();
			if (myDm.OpenConn() == true) this.Close();
			myDm.Dispose();
		}

		private void menuItem4_Click(object sender, System.EventArgs e)
		{
			Form_CaprazBulmaca yeniWindow = new Form_CaprazBulmaca();
			yeniWindow.MdiParent = this;
			yeniWindow.Show();
		}

		private void menuItem13_Click(object sender, System.EventArgs e)
		{
			Form_GenelAyarlar yeniWindow = new Form_GenelAyarlar();
			yeniWindow.MdiParent = this;
			yeniWindow.Show();
		}

		private void MainForm_KelimeEzber_TextChanged(object sender, System.EventArgs e)
		{
			this.notifyIcon1.Text = this.Text;
		}

		private void menuItem5_Click(object sender, System.EventArgs e)
		{
			Form_Sozluk yeniWindow = new Form_Sozluk();
			yeniWindow.MdiParent = this;
			yeniWindow.Show();
		}
	}
}