-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateBotForm.cs
88 lines (75 loc) · 2.17 KB
/
CreateBotForm.cs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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;
using TelegramBotsApp.Models;
namespace TelegramBotsApp
{
public partial class CreateBotForm : Form
{
public CreateBotForm()
{
InitializeComponent();
}
private void CreateBot_Click(object sender, EventArgs e)
{
Bot bot = new Bot { Name = textBox1.Text, Token = textBox2.Text };
if (!DataBase.Contain(bot))
{
DataBase.bots.Add(new Bot { Name = textBox1.Text, Token = textBox2.Text });
DataBase.Save();
this.Close();
}
else { }
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_Enter(object sender, EventArgs e)
{
if (textBox1.Text == "Имя")
{
textBox1.Text = "";
textBox1.ForeColor = Color.Black;
}
}
private void textBox2_Enter(object sender, EventArgs e)
{
if (textBox2.Text == "Токен")
{
textBox2.Text = "";
textBox2.ForeColor = Color.Black;
}
}
private void textBox1_Leave(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox1.Text == " ")
{
textBox1.Text = "Имя";
textBox1.ForeColor = Color.LightGray;
}
}
private void textBox2_Leave(object sender, EventArgs e)
{
if (textBox2.Text == "" || textBox2.Text == " ")
{
textBox2.Text = "Токен";
textBox2.ForeColor = Color.LightGray;
}
}
private void label1_Click(object sender, EventArgs e)
{
}
private void CreateBotForm_Load(object sender, EventArgs e)
{
}
}
}