-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
127 lines (106 loc) · 3.31 KB
/
Form1.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
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
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 System.IO;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Collections;
using System.Timers;
using System.Windows;
using System.Diagnostics;
using Timer = System.Timers.Timer;
namespace UDA_server_communication
{
public partial class Form1 : Form
{
public int contatore;
public string UDA_index;
public ArrayList L1 = new ArrayList();
// Alberto: continua a riempirli fino a 7
// Walter: Ho allungato l'Array List fino a coprire tutti e 7 i colori
public ArrayList txts = new ArrayList() { "IDLE"};
public ArrayList labels = new ArrayList() { "IDLE"};
public ArrayList colors = new ArrayList() { Color.DarkGreen };
public Form1(string x,int j)
{
txts.Add("START");
labels.Add("STARTED");
colors.Add(Color.DarkGreen);
txts.Add("ABORT");
labels.Add("ABORTED");
colors.Add(Color.DarkRed);
txts.Add("PAUSE");
labels.Add("PAUSED");
colors.Add(Color.DarkOrange);
txts.Add("RESUME");
labels.Add("RESUMED");
colors.Add(Color.Brown);
txts.Add("FINALIZED");
labels.Add("COMPLETED");
colors.Add(Color.DarkOrchid);
txts.Add("FINISHED");
labels.Add("FINALIZED");
colors.Add(Color.DarkCyan);
txts.Add("NOT IMPLEMENTED");
labels.Add("FINISHED");
colors.Add(Color.Purple);
ServerRequest r = new ServerRequest(this,x);
UDA_index = x;
InitializeComponent();
contatore = 0;
st.Visible = false;
label1.Visible = false;
textBox2.Visible = false;
}
public void Show_String(string s, int i)
{
this.BeginInvoke((Action)delegate ()
{
if (i == 1)
textBox1.Text = s;
else
textBox2.Text = s;
});
}
public void Status_Changed(string k, int i)
{
this.BeginInvoke((Action)delegate ()
{
st.Visible = true;
if (i == 2)
{
textBox2.Visible = true;
label1.Visible = true;
}
setSelection(Int32.Parse(k));
});
}
private void setSelection(int k)
{
st.ForeColor = (Color)colors[k];
label1.ForeColor = (Color)colors[k];
st.Text = (string)txts[k];
label1.Text = (string)labels[k];
}
private void Form1_Load(object sender, EventArgs e)
{
string nome;
nome= string.Concat("UDA ", UDA_index);
this.Text = nome;
}
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
var fr2 = new Form2();
fr2.Closed += (s, args) => this.Close();
fr2.Show();
}
}
}