-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormNameDayRestClient.cs
More file actions
107 lines (84 loc) · 2.93 KB
/
FormNameDayRestClient.cs
File metadata and controls
107 lines (84 loc) · 2.93 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using System;
using System.Drawing;
using System.Windows.Forms;
namespace NameDayRestClient
{
public partial class FormNameDayRestClient : Form
{
private readonly string ERROR = "Error";
private readonly string CONFIRMING = "Confirming";
public FormNameDayRestClient()
{
InitializeComponent();
}
private void aboutApplication()
{
Version dotNetVer = Environment.Version;
OperatingSystem os = Environment.OSVersion;
string message = "Author: Petr Faltus © March 2020";
message += Environment.NewLine;
message += Environment.NewLine;
message += ".NET version: " + dotNetVer;
message += Environment.NewLine;
message += "Operating system: " + os.VersionString;
message += Environment.NewLine;
message += " ";
string title = "About the " + this.Text;
MessageBox.Show(message, title);
}
private void searching()
{
string messageConfirming = "Really start the searching ?";
DialogResult confirmResult = MessageBox.Show(messageConfirming, CONFIRMING, MessageBoxButtons.YesNo);
if (confirmResult != DialogResult.Yes)
{
return;
}
if (String.IsNullOrEmpty(queryTextBox.Text))
{
string messageIfEmpty = "The name or date cannot be empty";
MessageBox.Show(messageIfEmpty, ERROR);
queryTextBox.Focus();
return;
}
string result = Search.run(queryTextBox.Text);
if (result == null)
{
string messageError = Search.getLastError();
MessageBox.Show(messageError, ERROR);
queryTextBox.Focus();
return;
}
resultLabel.Text = result;
queryTextBox.Text = "";
queryTextBox.Focus();
}
private void menuItemExitClick(object sender, EventArgs e)
{
this.Close();
}
private void menuItemSearchClick(object sender, EventArgs e)
{
searching();
}
private void menuItemAboutClick(object sender, EventArgs e)
{
aboutApplication();
}
private void queryTextBoxKeyDown(object sender, KeyEventArgs ke)
{
if (ke.KeyCode == Keys.Enter)
{
searching();
}
}
private void searchButtonClick(object sender, EventArgs e)
{
searching();
}
private void FormNameDayRestClientResize(object sender, EventArgs e)
{
this.resultPanel.Size = Size.Subtract(this.ClientSize, panelSizeDiff);
}
}
}