24 |
{ |
{ |
25 |
InitializeComponent(); |
InitializeComponent(); |
26 |
|
|
27 |
initClient(); |
//initClient(); is now called on shown() event |
28 |
|
// loadTransports(); is now called on shown() event |
29 |
|
|
|
loadTransports(); |
|
30 |
} |
} |
31 |
|
|
32 |
private void initClient() |
private void initClient() |
77 |
foreach (string t in transportNames) |
foreach (string t in transportNames) |
78 |
{ |
{ |
79 |
transportNameList.Add(t); |
transportNameList.Add(t); |
80 |
|
StatusData statusData = client.GetTransportStatus(t); |
81 |
bool enabled = client.GetTransportEnabled(t); |
bool enabled = statusData.transportEnabled; |
82 |
string status = ""; |
string status = ""; |
83 |
|
|
84 |
if (enabled) |
if (enabled) |
85 |
{ |
{ |
86 |
bool lastOk = client.GetTransportLastrunOk(t); |
bool lastOk = statusData.lastrunOk; |
87 |
|
|
88 |
if (lastOk) |
if (lastOk) |
89 |
{ |
{ |
153 |
|
|
154 |
private void transports_SelectedIndexChanged(object sender, EventArgs e) |
private void transports_SelectedIndexChanged(object sender, EventArgs e) |
155 |
{ |
{ |
156 |
loadFormData(); |
showData(); |
157 |
} |
} |
158 |
|
|
159 |
private void loadFormData() |
private void loadStatusData() |
160 |
{ |
{ |
161 |
if (transports.SelectedIndex == -1) |
if (transports.SelectedIndex == -1) |
162 |
return; |
return; |
163 |
|
|
164 |
string transportName = transportNameList[transports.SelectedIndex]; |
string transportName = transportNameList[transports.SelectedIndex]; |
165 |
|
|
166 |
bool enabled = client.GetTransportEnabled(transportName); |
StatusData statusData = client.GetTransportStatus(transportName); |
|
bool lastOk = client.GetTransportLastrunOk(transportName); |
|
|
|
|
|
string lastokTime = client.GetTransportLastOkTime(transportName); |
|
|
string lastErrorTime = client.GetTransportLastErrorTime(transportName); |
|
|
|
|
|
string errorMsg = client.GetTransportLastErrorMessage(transportName); |
|
167 |
|
|
168 |
int counter = client.GetTransportCounter(transportName); |
bool enabled = statusData.transportEnabled; |
169 |
|
|
170 |
txtTransport.Text = transportName; |
txtTransport.Text = transportName; |
171 |
txtEnabled.Text = "" + enabled; |
txtEnabled.Text = "" + enabled; |
172 |
txtLastOK.Text = "" + lastOk; |
txtLastOK.Text = "" + statusData.lastrunOk; |
173 |
|
|
174 |
txtOkTime.Text = lastokTime; |
txtOkTime.Text = statusData.lastOkTime; |
175 |
txtErrorTime.Text = lastErrorTime; |
txtErrorTime.Text = statusData.lastErrorTime; |
176 |
|
txtTransferTime.Text = statusData.lastTransferTime; |
177 |
|
|
178 |
txtErrorMsg.Text = errorMsg; |
txtErrorMsg.Text = statusData.lastErrorMessage; |
179 |
|
|
180 |
txtCounter.Text = "" + counter; |
txtCounter.Text = "" + statusData.counter; |
181 |
|
|
182 |
|
|
183 |
|
|
193 |
if (transports.SelectedIndex == -1) |
if (transports.SelectedIndex == -1) |
194 |
return; |
return; |
195 |
|
|
196 |
if (tabControl1.SelectedIndex != 0) //0 er status siden |
showData(); |
|
return; |
|
|
|
|
|
loadFormData(); |
|
197 |
} |
} |
198 |
|
|
199 |
private void loadLog() |
private void loadLog() |
233 |
|
|
234 |
} |
} |
235 |
|
|
236 |
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) |
private void showData() |
237 |
{ |
{ |
238 |
if (transports.SelectedIndex == -1) |
if (transports.SelectedIndex == -1) |
239 |
return; |
return; |
241 |
switch (tabControl1.SelectedIndex) |
switch (tabControl1.SelectedIndex) |
242 |
{ |
{ |
243 |
case 0: |
case 0: |
244 |
loadFormData(); |
loadStatusData(); |
245 |
break; |
break; |
246 |
case 1: |
case 1: |
247 |
loadLog(); |
loadLog(); |
252 |
} |
} |
253 |
} |
} |
254 |
|
|
255 |
|
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) |
256 |
|
{ |
257 |
|
showData(); |
258 |
|
} |
259 |
|
|
260 |
private void lnkServer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
private void lnkServer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
261 |
{ |
{ |
262 |
string tmp_hostname = Microsoft.VisualBasic.Interaction.InputBox("Indtast servernavn/ip", "MQ Gui", hostname); |
string tmp_hostname = Microsoft.VisualBasic.Interaction.InputBox("Indtast servernavn/ip", "MQ Gui", hostname); |
272 |
initClient(); |
initClient(); |
273 |
loadTransports(); |
loadTransports(); |
274 |
} |
} |
275 |
|
|
276 |
|
private void MainForm_Shown(object sender, EventArgs e) |
277 |
|
{ |
278 |
|
lnkServer.Text = "Connecting ..."; |
279 |
|
this.Refresh(); //force a redraw now () before we do the heavy work |
280 |
|
|
281 |
|
initClient(); |
282 |
|
loadTransports(); |
283 |
|
} |
284 |
|
|
285 |
} |
} |
286 |
} |
} |