-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdieciAsediciForm.cs
More file actions
157 lines (140 loc) · 5.34 KB
/
dieciAsediciForm.cs
File metadata and controls
157 lines (140 loc) · 5.34 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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.Globalization;
using System.Threading;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace Convertitore
{
public partial class dieciAsediciForm : Form
{
public dieciAsediciForm()
{
InitializeComponent();
if (home.languagename == 1)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("it-IT");
languagename = 1;
}
else if (home.languagename == 0)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
languagename = 0;
}
}
public string hexadecimal;
public string dex;
public int languagename;
public string messagebox1;
private void dieciAdueForm_Load(object sender, EventArgs e)
{
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
home form = new home();
form.Show();
this.Hide();
}
private void title_Click(object sender, EventArgs e)
{
}
//Dex To Bin
private void dex1_TextChanged(object sender, EventArgs e)
{
if (languagename == 1)
{
messagebox1 = "Inserisci solo cifre da 0 e 9";
}
else if (languagename == 0)
{
messagebox1 = "Enter only digits from 0 and 9";
}
string value = "0"; string value1 = "1"; string value2 = "2"; string value3 = "3"; string value4 = "4";
string value5 = "5"; string value6 = "6"; string value7 = "7"; string value8 = "8"; string value9 = "9";
if (dex1.Text.EndsWith(value) == true || dex1.Text.EndsWith(value1) == true
|| dex1.Text.EndsWith(value2) == true || dex1.Text.EndsWith(value3) == true
|| dex1.Text.EndsWith(value4) == true || dex1.Text.EndsWith(value5) == true
|| dex1.Text.EndsWith(value6) == true || dex1.Text.EndsWith(value7) == true
|| dex1.Text.EndsWith(value8) == true || dex1.Text.EndsWith(value9) == true)
{
int valuestring = (int)Convert.ToInt64(dex1.Text);
hexadecimal = Convert.ToString(valuestring, 16);
}
else if (dex1.Text == string.Empty)
{
}
else
{
MessageBox.Show(messagebox1);
dex1.Text = "";
}
}
private void calcola1_Click(object sender, EventArgs e)
{
if (dex1.Text != string.Empty)
{
hex1.Text = hexadecimal.ToUpper();
}
else
{
dex1.Text = "0";
hex1.Text = "0";
}
}
//Bin to Dex
private void hex2_TextChanged(object sender, EventArgs e)
{
if (languagename == 1)
{
messagebox1 = "Inserisci solo cifre da 0 e 9 e lettere da A a F";
}
else if (languagename == 0)
{
messagebox1 = "Enter digits 0 to 9 and letters A to F only";
}
string value = "0"; string value1 = "1"; string value2 = "2"; string value3 = "3"; string value4 = "4";
string value5 = "5"; string value6 = "6"; string value7 = "7"; string value8 = "8"; string value9 = "9";
string value10 = "A"; string value11 = "B"; string value12 = "C";string value13 = "D"; string value14 = "E";
string value15= "F";
if (hex2.Text.EndsWith(value) == true || hex2.Text.EndsWith(value1) == true
|| hex2.Text.EndsWith(value2) == true || hex2.Text.EndsWith(value3) == true
|| hex2.Text.EndsWith(value4) == true || hex2.Text.EndsWith(value5) == true
|| hex2.Text.EndsWith(value6) == true || hex2.Text.EndsWith(value7) == true
|| hex2.Text.EndsWith(value8) == true || hex2.Text.EndsWith(value9) == true
|| hex2.Text.EndsWith(value10) == true || hex2.Text.EndsWith(value11) == true
|| hex2.Text.EndsWith(value12) == true || hex2.Text.EndsWith(value12) == true
|| hex2.Text.EndsWith(value13) == true || hex2.Text.EndsWith(value14) == true
|| hex2.Text.EndsWith(value15) == true)
{
int valuestring = (int)Convert.ToInt64(hex2.Text, 16);
dex = Convert.ToString(valuestring);
}
else if (hex2.Text == string.Empty)
{
}
else
{
MessageBox.Show(messagebox1);
hex2.Text = "";
}
}
private void calcola2_Click(object sender, EventArgs e)
{
if (hex2.Text != string.Empty)
{
dex2.Text = dex;
}
else
{
dex2.Text = "0";
hex2.Text = "0";
}
}
}
}