64 |
return result; |
return result; |
65 |
} |
} |
66 |
|
|
67 |
|
public int getSelectedTransportIndex() |
68 |
|
{ |
69 |
|
if (transports.SelectedIndices.Count == 0) |
70 |
|
return -1; |
71 |
|
else |
72 |
|
return transports.SelectedIndices[0]; |
73 |
|
} |
74 |
|
|
75 |
public void loadTransports() |
public void loadTransports() |
76 |
{ |
{ |
77 |
int selected = transports.SelectedIndex; |
|
78 |
|
int selected = getSelectedTransportIndex(); |
79 |
if (selected == -1) //er der ikke valgt - vælger vi den første |
if (selected == -1) //er der ikke valgt - vælger vi den første |
80 |
selected = 0; |
selected = 0; |
81 |
|
|
89 |
StatusData statusData = client.GetTransportStatus(t); |
StatusData statusData = client.GetTransportStatus(t); |
90 |
bool enabled = statusData.transportEnabled; |
bool enabled = statusData.transportEnabled; |
91 |
string status = ""; |
string status = ""; |
92 |
|
Color bgColor; |
93 |
if (enabled) |
if (enabled) |
94 |
{ |
{ |
95 |
bool lastOk = statusData.lastrunOk; |
bool lastOk = statusData.lastrunOk; |
96 |
|
|
97 |
if (lastOk) |
if (lastOk) |
98 |
{ |
{ |
99 |
status = "running"; |
status = "running"; |
100 |
|
bgColor = Color.Green; |
101 |
} |
} |
102 |
else |
else |
103 |
{ |
{ |
104 |
status = "error"; |
status = "error"; |
105 |
|
bgColor = Color.Red; |
106 |
} |
} |
107 |
} |
} |
108 |
else |
else |
109 |
{ |
{ |
110 |
status = "stopped"; |
status = "stopped"; |
111 |
|
bgColor = Color.DarkOrange; |
112 |
} |
} |
113 |
|
|
114 |
transports.Items.Add(t + " - " + status); |
ListViewItem item = new ListViewItem(t + " - " + status); |
115 |
|
item.ForeColor = bgColor; |
116 |
|
transports.Items.Add(item); |
117 |
} |
} |
118 |
|
|
119 |
|
|
125 |
selected = -1; |
selected = -1; |
126 |
} |
} |
127 |
|
|
128 |
transports.SelectedIndex = selected; |
transports.SelectedIndices.Clear(); |
129 |
|
if (selected != -1) |
130 |
|
transports.SelectedIndices.Add(selected); |
131 |
|
//transports.SelectedIndices[0] = selected; |
132 |
|
|
133 |
} |
} |
134 |
|
|
175 |
|
|
176 |
private void loadStatusData() |
private void loadStatusData() |
177 |
{ |
{ |
178 |
if (transports.SelectedIndex == -1) |
if (getSelectedTransportIndex() == -1) |
179 |
return; |
return; |
180 |
|
|
181 |
string transportName = transportNameList[transports.SelectedIndex]; |
string transportName = transportNameList[getSelectedTransportIndex() ]; |
182 |
|
|
183 |
StatusData statusData = client.GetTransportStatus(transportName); |
StatusData statusData = client.GetTransportStatus(transportName); |
184 |
|
|
205 |
|
|
206 |
private void refreshTimer_Tick(object sender, EventArgs e) |
private void refreshTimer_Tick(object sender, EventArgs e) |
207 |
{ |
{ |
208 |
loadTransports(); |
loadTransports(); |
209 |
|
|
210 |
if (transports.SelectedIndex == -1) |
if (getSelectedTransportIndex() == -1) |
211 |
return; |
return; |
212 |
|
|
213 |
showData(); |
showData(); |
215 |
|
|
216 |
private void loadLog() |
private void loadLog() |
217 |
{ |
{ |
218 |
if (transports.SelectedIndex == -1) |
if (getSelectedTransportIndex() == -1) |
219 |
return; |
return; |
220 |
string transportName = transportNameList[transports.SelectedIndex]; |
string transportName = transportNameList[getSelectedTransportIndex()]; |
221 |
|
|
222 |
string[] logEntries = client.GetTransportLog(transportName); |
string[] logEntries = client.GetTransportLog(transportName); |
223 |
|
|
232 |
|
|
233 |
private void loadConfig() |
private void loadConfig() |
234 |
{ |
{ |
235 |
if (transports.SelectedIndex == -1) |
if (getSelectedTransportIndex() == -1) |
236 |
return; |
return; |
237 |
string transportName = transportNameList[transports.SelectedIndex]; |
string transportName = transportNameList[getSelectedTransportIndex()]; |
238 |
|
|
239 |
string direction = client.GetTransportDirection(transportName); |
string direction = client.GetTransportDirection(transportName); |
240 |
string queue = client.GetTransportQueueName(transportName); |
string queue = client.GetTransportQueueName(transportName); |
252 |
|
|
253 |
private void showData() |
private void showData() |
254 |
{ |
{ |
255 |
if (transports.SelectedIndex == -1) |
if (getSelectedTransportIndex() == -1) |
256 |
return; |
return; |
257 |
|
|
258 |
switch (tabControl1.SelectedIndex) |
switch (tabControl1.SelectedIndex) |