diff --git a/DugunSalonu.csproj b/DugunSalonu.csproj index 2536c19..e5c82cf 100644 --- a/DugunSalonu.csproj +++ b/DugunSalonu.csproj @@ -26,12 +26,21 @@ Form + + True + True + Resources.resx + + + ResXFileCodeGenerator + Resources.Designer.cs + \ No newline at end of file diff --git a/FrmLogin.Designer.cs b/FrmLogin.Designer.cs index 7fd051f..709a3c2 100644 --- a/FrmLogin.Designer.cs +++ b/FrmLogin.Designer.cs @@ -35,24 +35,33 @@ label1 = new Label(); label2 = new Label(); fileSystemWatcher1 = new FileSystemWatcher(); + pnlTop = new Panel(); + btnExit = new Button(); + label3 = new Label(); ((System.ComponentModel.ISupportInitialize)fileSystemWatcher1).BeginInit(); + pnlTop.SuspendLayout(); SuspendLayout(); // // btnGiris // + btnGiris.BackgroundImage = Properties.Resources.loginKapali; + btnGiris.BackgroundImageLayout = ImageLayout.Stretch; + btnGiris.FlatAppearance.BorderSize = 0; + btnGiris.FlatAppearance.MouseDownBackColor = Color.FromArgb(192, 255, 192); + btnGiris.FlatAppearance.MouseOverBackColor = Color.Lime; + btnGiris.FlatStyle = FlatStyle.Flat; btnGiris.Font = new Font("Segoe UI", 9F, FontStyle.Bold); - btnGiris.Location = new Point(149, 90); + btnGiris.Location = new Point(123, 154); btnGiris.Name = "btnGiris"; - btnGiris.Size = new Size(75, 32); + btnGiris.Size = new Size(62, 48); btnGiris.TabIndex = 0; - btnGiris.Text = "GiriÅŸ"; btnGiris.UseVisualStyleBackColor = true; btnGiris.Click += btnGiris_Click; // // btnVazgec // btnVazgec.Font = new Font("Segoe UI", 9F, FontStyle.Bold); - btnVazgec.Location = new Point(230, 90); + btnVazgec.Location = new Point(218, 162); btnVazgec.Name = "btnVazgec"; btnVazgec.Size = new Size(75, 32); btnVazgec.TabIndex = 1; @@ -62,25 +71,28 @@ // // txtKullanici // - txtKullanici.Location = new Point(135, 22); + txtKullanici.Font = new Font("Segoe UI", 12F); + txtKullanici.Location = new Point(123, 76); txtKullanici.Name = "txtKullanici"; - txtKullanici.Size = new Size(170, 23); + txtKullanici.Size = new Size(170, 29); txtKullanici.TabIndex = 2; // // txtSifre // - txtSifre.Location = new Point(135, 61); + txtSifre.Font = new Font("Segoe UI", 12F); + txtSifre.Location = new Point(123, 115); txtSifre.Name = "txtSifre"; - txtSifre.Size = new Size(170, 23); + txtSifre.Size = new Size(170, 29); txtSifre.TabIndex = 3; txtSifre.UseSystemPasswordChar = true; // // label1 // label1.AutoSize = true; - label1.BackColor = SystemColors.ActiveCaption; + label1.BackColor = Color.Transparent; label1.Font = new Font("Segoe UI", 9F, FontStyle.Bold); - label1.Location = new Point(56, 25); + label1.ForeColor = Color.White; + label1.Location = new Point(43, 84); label1.Name = "label1"; label1.Size = new Size(74, 15); label1.TabIndex = 4; @@ -89,9 +101,10 @@ // label2 // label2.AutoSize = true; - label2.BackColor = SystemColors.ActiveCaption; + label2.BackColor = Color.Transparent; label2.Font = new Font("Segoe UI", 9F, FontStyle.Bold); - label2.Location = new Point(99, 64); + label2.ForeColor = Color.White; + label2.Location = new Point(86, 123); label2.Name = "label2"; label2.Size = new Size(34, 15); label2.TabIndex = 5; @@ -102,25 +115,71 @@ fileSystemWatcher1.EnableRaisingEvents = true; fileSystemWatcher1.SynchronizingObject = this; // + // pnlTop + // + pnlTop.BackColor = Color.FromArgb(255, 128, 0); + pnlTop.Controls.Add(btnExit); + pnlTop.Controls.Add(label3); + pnlTop.Dock = DockStyle.Top; + pnlTop.Location = new Point(0, 0); + pnlTop.Name = "pnlTop"; + pnlTop.Size = new Size(347, 38); + pnlTop.TabIndex = 6; + pnlTop.MouseDown += pnlTop_MouseDown; + // + // btnExit + // + btnExit.Anchor = AnchorStyles.Top | AnchorStyles.Right; + btnExit.BackColor = Color.Red; + btnExit.FlatAppearance.BorderSize = 0; + btnExit.FlatAppearance.MouseDownBackColor = Color.FromArgb(255, 192, 192); + btnExit.FlatAppearance.MouseOverBackColor = Color.FromArgb(255, 128, 128); + btnExit.FlatStyle = FlatStyle.Flat; + btnExit.Font = new Font("Segoe UI", 9F, FontStyle.Bold); + btnExit.ForeColor = Color.White; + btnExit.Location = new Point(289, 2); + btnExit.Name = "btnExit"; + btnExit.Size = new Size(51, 35); + btnExit.TabIndex = 7; + btnExit.Text = "X"; + btnExit.UseVisualStyleBackColor = false; + btnExit.Click += btnExit_Click; + // + // label3 + // + label3.AutoSize = true; + label3.Font = new Font("Segoe UI", 15F, FontStyle.Bold); + label3.ForeColor = Color.White; + label3.Location = new Point(12, 4); + label3.Name = "label3"; + label3.Size = new Size(130, 28); + label3.TabIndex = 0; + label3.Text = "Login Formu"; + // // FrmLogin // AcceptButton = btnGiris; AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - BackColor = SystemColors.ActiveCaption; + BackColor = SystemColors.AppWorkspace; CancelButton = btnVazgec; - ClientSize = new Size(316, 134); + ClientSize = new Size(347, 234); + ControlBox = false; + Controls.Add(pnlTop); Controls.Add(label2); Controls.Add(label1); Controls.Add(txtSifre); Controls.Add(txtKullanici); Controls.Add(btnVazgec); Controls.Add(btnGiris); - FormBorderStyle = FormBorderStyle.Fixed3D; + FormBorderStyle = FormBorderStyle.None; Name = "FrmLogin"; + StartPosition = FormStartPosition.CenterScreen; Text = "Login"; Load += FrmLogin_Load; ((System.ComponentModel.ISupportInitialize)fileSystemWatcher1).EndInit(); + pnlTop.ResumeLayout(false); + pnlTop.PerformLayout(); ResumeLayout(false); PerformLayout(); } @@ -134,5 +193,8 @@ private Label label1; private Label label2; private FileSystemWatcher fileSystemWatcher1; + private Panel pnlTop; + private Button btnExit; + private Label label3; } } diff --git a/FrmLogin.cs b/FrmLogin.cs index cc64998..14a20b7 100644 --- a/FrmLogin.cs +++ b/FrmLogin.cs @@ -3,6 +3,8 @@ using Microsoft.EntityFrameworkCore; using System.Threading.Tasks; using System.Windows.Forms; using System.Buffers; +using System.Resources; +using DugunSalonu.Properties; namespace DugunSalonu { @@ -10,12 +12,23 @@ namespace DugunSalonu { public FrmLogin() { + InitializeComponent(); } + public const int WM_NCLBUTTONDOWN = 0xA1; + public const int HT_CAPTION = 0x2; + + [System.Runtime.InteropServices.DllImport("user32.dll")] + public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); + [System.Runtime.InteropServices.DllImport("user32.dll")] + public static extern bool ReleaseCapture(); + + + private void FrmLogin_Load(object sender, EventArgs e) { - + } private void btnVazgec_Click(object sender, EventArgs e) @@ -25,6 +38,7 @@ namespace DugunSalonu private async void btnGiris_Click(object sender, EventArgs e) { + try { using (dugunsalonuContext db = new dugunsalonuContext()) @@ -32,11 +46,13 @@ namespace DugunSalonu var user = await db.kullanici.Where(k => k.kullaniciadi == txtKullanici.Text && k.aktif == true && k.parola == txtSifre.Text).FirstOrDefaultAsync(); if (user != null) { + btnGiris.BackgroundImage = Resources.loginAcik; + Task.Delay(2000).Wait(); FrmAddKullanici f1 = new FrmAddKullanici(); f1.Show(); this.Hide(); } - else { MessageBox.Show("Hatalý kullanýcý bilgileri.","Hata"); } + else { MessageBox.Show("Hatalý kullanýcý bilgileri.", "Hata"); } //Kullanici girisKullanicisi = await db.Kullanici.Where(k => k.KullaniciAdi == txtKullanici.Text && k.Parola == txtSifre.Text).FirstOrDefaultAsync(); } } @@ -46,6 +62,20 @@ namespace DugunSalonu throw; } } + + private void btnExit_Click(object sender, EventArgs e) + { + Application.Exit(); + } + + private void pnlTop_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + ReleaseCapture(); + SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); + } + } } } diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..84243ef --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// +// Bu kod araç tarafından oluÅŸturuldu. +// Çalışma Zamanı Sürümü:4.0.30319.42000 +// +// Bu dosyada yapılacak deÄŸiÅŸiklikler yanlış davranışa neden olabilir ve +// kod yeniden oluÅŸturulursa kaybolur. +// +//------------------------------------------------------------------------------ + +namespace DugunSalonu.Properties { + using System; + + + /// + /// YerelleÅŸtirilmiÅŸ dizeleri aramak gibi iÅŸlemler için, türü kesin olarak belirtilmiÅŸ kaynak sınıfı. + /// + // Bu sınıf ResGen veya Visual Studio gibi bir araç kullanılarak StronglyTypedResourceBuilder + // sınıfı tarafından otomatik olarak oluÅŸturuldu. + // Üye eklemek veya kaldırmak için .ResX dosyanızı düzenleyin ve sonra da ResGen + // komutunu /str seçeneÄŸiyle yeniden çalıştırın veya VS projenizi yeniden oluÅŸturun. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Bu sınıf tarafından kullanılan, önbelleÄŸe alınmış ResourceManager örneÄŸini döndürür. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DugunSalonu.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Tümü için geçerli iÅŸ parçacığının CurrentUICulture özelliÄŸini geçersiz kular + /// CurrentUICulture özelliÄŸini tüm kaynak aramaları için geçersiz kılar. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// System.Drawing.Bitmap türünde yerelleÅŸtirilmiÅŸ bir kaynak arar. + /// + internal static System.Drawing.Bitmap login { + get { + object obj = ResourceManager.GetObject("login", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// System.Drawing.Bitmap türünde yerelleÅŸtirilmiÅŸ bir kaynak arar. + /// + internal static System.Drawing.Bitmap loginAcik { + get { + object obj = ResourceManager.GetObject("loginAcik", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// System.Drawing.Bitmap türünde yerelleÅŸtirilmiÅŸ bir kaynak arar. + /// + internal static System.Drawing.Bitmap loginKapali { + get { + object obj = ResourceManager.GetObject("loginKapali", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..00038a3 --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\loginAcik.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\login.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\loginKapali.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/Resources/login.png b/Resources/login.png new file mode 100644 index 0000000..291d034 Binary files /dev/null and b/Resources/login.png differ diff --git a/Resources/loginAcik.png b/Resources/loginAcik.png new file mode 100644 index 0000000..d6ce915 Binary files /dev/null and b/Resources/loginAcik.png differ diff --git a/Resources/loginKapali.png b/Resources/loginKapali.png new file mode 100644 index 0000000..8967c3e Binary files /dev/null and b/Resources/loginKapali.png differ