Repository navigation
Expand file tree
/
Copy pathAdminPanel.cs
More file actions
64 lines (57 loc) · 1.88 KB
/
Copy pathAdminPanel.cs
File metadata and controls
64 lines (57 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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 ProjectAvtoMoika
{
public partial class AdminPass : Form
{
private Action<Form> openFormAction;
public AdminPass(Action<Form> openFormAction)
{
InitializeComponent();
this.openFormAction = openFormAction;
TextParol.Text = "Введите пароль: ";
TextParol.UseSystemPasswordChar = false;
}
private void TextParol_Enter(object sender, EventArgs e)
{
if (TextParol.Text == "Введите пароль: ")
{
TextParol.Text = "";
TextParol.UseSystemPasswordChar = true;
}
}
private void TextParol_Leave(object sender, EventArgs e)
{
if (TextParol.Text == "")
{
TextParol.Text = "Введите пароль: ";
TextParol.UseSystemPasswordChar = false;
}
}
private void Avtoriz_Click(object sender, EventArgs e)
{
string correctPassword = "1111";
if (TextParol.Text == "Введите пароль: ")
{
MessageBox.Show("Введите админ пароль!");
return;
}
if (TextParol.Text == correctPassword)
{
MessageBox.Show("Пароль верный, доступ получен!");
openFormAction(new AdminTable());
}
else
{
MessageBox.Show("Неверный пароль. Попробуйте еще раз.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}