-
Notifications
You must be signed in to change notification settings - Fork 1
/
NumberInputForm.cs
62 lines (57 loc) · 1.79 KB
/
NumberInputForm.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SwProjectInterface
{
public partial class NumberInputForm : Form
{
public int number;
public string prefix;
public string suffix;
public string name;
public bool OK = false;
public bool working = true;
private Project _project;
public NumberInputForm(Project project, string prefix, string suffix)
{
InitializeComponent();
_project = project;
nameGroupBox.Text = Settings.Default.propertyName;
prefixTextBox.Text = prefix;
suffixTextBox.Text = suffix;
for (int i = 1; i <= 9999; i++)
{
if (!_project.numbers.Exists(element => element == i))
{
numericUpDown1.Value = i;
break;
}
}
}
private void okButton_Click(object sender, EventArgs e)
{
number = (int)numericUpDown1.Value;
prefix = prefixTextBox.Text.Trim();
suffix = suffixTextBox.Text.Trim();
if (number < 1 || number > 9999)
{
MessageBox.Show("Number has to be in range (1; 9999)!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
name = nameTextBox.Text;
OK = true;
working = false;
this.Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
working = false;
this.Close();
}
}
}