diff --git a/OpsFlow/UI/Controls/NavbarControl.cs b/OpsFlow/UI/Controls/NavbarControl.cs index a05b077..5bd78a8 100644 --- a/OpsFlow/UI/Controls/NavbarControl.cs +++ b/OpsFlow/UI/Controls/NavbarControl.cs @@ -1,9 +1,11 @@ -using Guna.UI2.WinForms; - -using System.ComponentModel; +using System.ComponentModel; using System.Security.Cryptography; using System.Text; +using Guna.UI2.WinForms; + +using OpsFlow.UI.Forms.Management; + using Timer = System.Windows.Forms.Timer; namespace OpsFlow.UI.Controls; @@ -285,7 +287,42 @@ private void InitializeDropdownMenu() ImageOffset = new Point(5, 0), TextOffset = new Point(10, 0) }; - _btnLogout.Click += (s, e) => Application.Restart(); + + _btnLogout.Click += (s, e) => + { + if (this.ParentForm is Form anaForm) + { + Form dimmer = new Form(); + dimmer.FormBorderStyle = FormBorderStyle.None; + dimmer.BackColor = Color.Black; + dimmer.Opacity = 0.60d; + dimmer.ShowInTaskbar = false; + dimmer.StartPosition = FormStartPosition.Manual; + + dimmer.Location = anaForm.PointToScreen(Point.Empty); + dimmer.Size = anaForm.Size; + + using (LogoutForm confirmation = new LogoutForm()) + { + confirmation.StartPosition = FormStartPosition.CenterScreen; + + dimmer.Show(anaForm); + + DialogResult result = confirmation.ShowDialog(dimmer); + + dimmer.Close(); + + if (result == DialogResult.Yes) + { + Application.Exit(); + } + } + } + else + { + Application.Exit(); + } + }; _dropdownPanel.Controls.Add(_btnSettings); _dropdownPanel.Controls.Add(separator); diff --git a/OpsFlow/UI/Forms/Management/AddPersonelForm.Designer.cs b/OpsFlow/UI/Forms/Management/AddPersonelForm.Designer.cs index 4823d6b..18183fd 100644 --- a/OpsFlow/UI/Forms/Management/AddPersonelForm.Designer.cs +++ b/OpsFlow/UI/Forms/Management/AddPersonelForm.Designer.cs @@ -266,7 +266,8 @@ private void InitializeComponent() txtTelephone.SelectedText = ""; txtTelephone.ShadowDecoration.CustomizableEdges = customizableEdges10; txtTelephone.Size = new Size(300, 42); - txtTelephone.TabIndex = 34; + txtTelephone.TabIndex = 14; + txtTelephone.TextChanged += txtTelephone_TextChanged; // // guna2HtmlLabel11 // @@ -313,7 +314,7 @@ private void InitializeComponent() txtSurname.SelectedText = ""; txtSurname.ShadowDecoration.CustomizableEdges = customizableEdges12; txtSurname.Size = new Size(140, 42); - txtSurname.TabIndex = 31; + txtSurname.TabIndex = 12; // // txtName // @@ -338,7 +339,7 @@ private void InitializeComponent() txtName.SelectedText = ""; txtName.ShadowDecoration.CustomizableEdges = customizableEdges14; txtName.Size = new Size(140, 42); - txtName.TabIndex = 30; + txtName.TabIndex = 11; // // txtPassword // @@ -364,7 +365,7 @@ private void InitializeComponent() txtPassword.SelectedText = ""; txtPassword.ShadowDecoration.CustomizableEdges = customizableEdges16; txtPassword.Size = new Size(300, 42); - txtPassword.TabIndex = 6; + txtPassword.TabIndex = 15; // // guna2HtmlLabel9 // @@ -480,7 +481,7 @@ private void InitializeComponent() txtEmail.SelectedText = ""; txtEmail.ShadowDecoration.CustomizableEdges = customizableEdges24; txtEmail.Size = new Size(300, 42); - txtEmail.TabIndex = 4; + txtEmail.TabIndex = 13; // // picProfilePhoto // diff --git a/OpsFlow/UI/Forms/Management/AddPersonelForm.cs b/OpsFlow/UI/Forms/Management/AddPersonelForm.cs index 7003fab..c893aa7 100644 --- a/OpsFlow/UI/Forms/Management/AddPersonelForm.cs +++ b/OpsFlow/UI/Forms/Management/AddPersonelForm.cs @@ -23,9 +23,10 @@ public partial class AddPersonelForm : BaseForm public AddPersonelForm() { InitializeComponent(); + txtTelephone.MaxLength = 17; if (this.HeaderPanel != null) this.HeaderPanel.SendToBack(); _fileUploadService = FileUploadServiceFactory.Create(); - + this.Load += AddPersonelForm_Load; btnSave.Click += BtnSave_Click; cmbRole.SelectedIndexChanged += CmbRole_SelectedIndexChanged; @@ -65,7 +66,7 @@ private async Task LoadComboBoxDataAsync() using var roleContext = DatabaseManager.CreateContext(); using var companyContext = DatabaseManager.CreateContext(); using var departmentContext = DatabaseManager.CreateContext(); - + var roleService = new RoleService(roleContext); var companyService = new CompanyService(companyContext); var departmentService = new DepartmentService(departmentContext); @@ -170,7 +171,7 @@ private async void picProfilePhoto_Click_1(object sender, EventArgs e) string uploadedPath = await _fileUploadService.UploadProfilePhotoAsync(selectedFilePath); _uploadedFilePath = uploadedPath; - if (Uri.TryCreate(uploadedPath, UriKind.Absolute, out Uri? uri) && + if (Uri.TryCreate(uploadedPath, UriKind.Absolute, out Uri? uri) && (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)) { using (HttpClient client = new HttpClient()) @@ -430,5 +431,10 @@ private void btnCompanyRegister_Click(object sender, EventArgs e) } } } + + private void txtTelephone_TextChanged(object sender, EventArgs e) + { + + } } } \ No newline at end of file diff --git a/OpsFlow/UI/Forms/Management/LogoutForm.Designer.cs b/OpsFlow/UI/Forms/Management/LogoutForm.Designer.cs new file mode 100644 index 0000000..83ab589 --- /dev/null +++ b/OpsFlow/UI/Forms/Management/LogoutForm.Designer.cs @@ -0,0 +1,126 @@ +namespace OpsFlow.UI.Forms.Management; + +partial class LogoutForm +{ + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges1 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges2 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges3 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + Guna.UI2.WinForms.Suite.CustomizableEdges customizableEdges4 = new Guna.UI2.WinForms.Suite.CustomizableEdges(); + guna2HtmlLabel1 = new Guna.UI2.WinForms.Guna2HtmlLabel(); + guna2HtmlLabel9 = new Guna.UI2.WinForms.Guna2HtmlLabel(); + btnConfirmLogout = new Guna.UI2.WinForms.Guna2Button(); + btnCancel = new Guna.UI2.WinForms.Guna2Button(); + SuspendLayout(); + // + // guna2HtmlLabel1 + // + guna2HtmlLabel1.BackColor = Color.Transparent; + guna2HtmlLabel1.Font = new Font("Poppins", 24F, FontStyle.Bold, GraphicsUnit.Point, 162); + guna2HtmlLabel1.ForeColor = Color.White; + guna2HtmlLabel1.Location = new Point(303, 56); + guna2HtmlLabel1.Name = "guna2HtmlLabel1"; + guna2HtmlLabel1.Size = new Size(195, 72); + guna2HtmlLabel1.TabIndex = 3; + guna2HtmlLabel1.Text = "Çıkış Yap"; + // + // guna2HtmlLabel9 + // + guna2HtmlLabel9.BackColor = Color.Transparent; + guna2HtmlLabel9.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 162); + guna2HtmlLabel9.ForeColor = Color.White; + guna2HtmlLabel9.Location = new Point(143, 139); + guna2HtmlLabel9.Name = "guna2HtmlLabel9"; + guna2HtmlLabel9.Size = new Size(514, 27); + guna2HtmlLabel9.TabIndex = 30; + guna2HtmlLabel9.Text = "Hesabınızdan çıkış yapmak istediğinize emin misiniz?"; + guna2HtmlLabel9.TextAlignment = ContentAlignment.MiddleCenter; + // + // btnConfirmLogout + // + btnConfirmLogout.BorderRadius = 12; + btnConfirmLogout.CustomizableEdges = customizableEdges1; + btnConfirmLogout.DisabledState.BorderColor = Color.DarkGray; + btnConfirmLogout.DisabledState.CustomBorderColor = Color.DarkGray; + btnConfirmLogout.DisabledState.FillColor = Color.FromArgb(169, 169, 169); + btnConfirmLogout.DisabledState.ForeColor = Color.FromArgb(141, 141, 141); + btnConfirmLogout.FillColor = Color.FromArgb(211, 95, 95); + btnConfirmLogout.Font = new Font("Poppins", 12F, FontStyle.Bold, GraphicsUnit.Point, 162); + btnConfirmLogout.ForeColor = Color.White; + btnConfirmLogout.Location = new Point(143, 257); + btnConfirmLogout.Name = "btnConfirmLogout"; + btnConfirmLogout.ShadowDecoration.CustomizableEdges = customizableEdges2; + btnConfirmLogout.Size = new Size(221, 64); + btnConfirmLogout.TabIndex = 31; + btnConfirmLogout.Text = "Çıkış Yap"; + btnConfirmLogout.Click += btnConfirmLogout_Click; + // + // btnCancel + // + btnCancel.BorderRadius = 12; + btnCancel.CustomizableEdges = customizableEdges3; + btnCancel.DisabledState.BorderColor = Color.DarkGray; + btnCancel.DisabledState.CustomBorderColor = Color.DarkGray; + btnCancel.DisabledState.FillColor = Color.FromArgb(169, 169, 169); + btnCancel.DisabledState.ForeColor = Color.FromArgb(141, 141, 141); + btnCancel.FillColor = Color.FromArgb(149, 165, 166); + btnCancel.Font = new Font("Poppins", 12F, FontStyle.Bold, GraphicsUnit.Point, 162); + btnCancel.ForeColor = Color.White; + btnCancel.Location = new Point(436, 257); + btnCancel.Name = "btnCancel"; + btnCancel.ShadowDecoration.CustomizableEdges = customizableEdges4; + btnCancel.Size = new Size(221, 64); + btnCancel.TabIndex = 32; + btnCancel.Text = "İptal"; + btnCancel.Click += btnCancel_Click; + // + // LogoutForm + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = Color.FromArgb(26, 31, 46); + ClientSize = new Size(800, 376); + Controls.Add(btnCancel); + Controls.Add(btnConfirmLogout); + Controls.Add(guna2HtmlLabel9); + Controls.Add(guna2HtmlLabel1); + FormBorderStyle = FormBorderStyle.None; + Name = "LogoutForm"; + StartPosition = FormStartPosition.CenterScreen; + Text = "LogoutForm"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Guna.UI2.WinForms.Guna2HtmlLabel guna2HtmlLabel1; + private Guna.UI2.WinForms.Guna2HtmlLabel guna2HtmlLabel9; + private Guna.UI2.WinForms.Guna2Button btnConfirmLogout; + private Guna.UI2.WinForms.Guna2Button btnCancel; +} \ No newline at end of file diff --git a/OpsFlow/UI/Forms/Management/LogoutForm.cs b/OpsFlow/UI/Forms/Management/LogoutForm.cs new file mode 100644 index 0000000..027ff05 --- /dev/null +++ b/OpsFlow/UI/Forms/Management/LogoutForm.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace OpsFlow.UI.Forms.Management; + +public partial class LogoutForm : Form +{ + public LogoutForm() + { + InitializeComponent(); + } + + private void btnConfirmLogout_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Yes; + this.Close(); + } + + private void btnCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.No; + this.Close(); + } +} diff --git a/OpsFlow/UI/Forms/Management/LogoutForm.resx b/OpsFlow/UI/Forms/Management/LogoutForm.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/OpsFlow/UI/Forms/Management/LogoutForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file