7 |
using System.Windows.Forms; |
using System.Windows.Forms; |
8 |
|
|
9 |
using DaoMqGUI.ServiceReference1; |
using DaoMqGUI.ServiceReference1; |
10 |
|
using System.ServiceModel; |
11 |
|
using Microsoft.Win32; |
12 |
|
|
13 |
namespace DaoMqGUI |
namespace DaoMqGUI |
14 |
{ |
{ |
15 |
public partial class MainForm : Form |
public partial class MainForm : Form |
16 |
{ |
{ |
17 |
RemoteControlClient client = new RemoteControlClient(); |
RemoteControlClient client = null; |
18 |
|
|
19 |
List<string> transportNameList = new List<string>(); |
List<string> transportNameList = new List<string>(); |
20 |
|
|
21 |
|
string hostname = ""; |
22 |
|
|
23 |
public MainForm() |
public MainForm() |
24 |
{ |
{ |
25 |
InitializeComponent(); |
InitializeComponent(); |
26 |
|
|
27 |
|
initClient(); |
28 |
|
|
29 |
loadTransports(); |
loadTransports(); |
30 |
} |
} |
31 |
|
|
32 |
|
private void initClient() |
33 |
|
{ |
34 |
|
RegistryKey key = Registry.LocalMachine.CreateSubKey("Software\\DAO\\DaoMqGui"); |
35 |
|
|
36 |
|
hostname = (string) key.GetValue("Hostname", "localhost"); |
37 |
|
hostname = hostname.Trim(); |
38 |
|
|
39 |
|
lnkServer.Text = hostname; |
40 |
|
|
41 |
|
//Step 1 - initialize client |
42 |
|
BasicHttpBinding binding = new BasicHttpBinding(); |
43 |
|
EndpointAddress endpoint = new EndpointAddress(new Uri("http://" + hostname + ":8000/RemoteControl/RemoteControl")); |
44 |
|
client = new RemoteControlClient(binding, endpoint); |
45 |
|
} |
46 |
|
|
47 |
private string[] getSafeTransports() |
private string[] getSafeTransports() |
48 |
{ |
{ |
49 |
string[] result = new string[] { }; |
string[] result = new string[] { }; |
260 |
} |
} |
261 |
} |
} |
262 |
|
|
263 |
|
private void lnkServer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
264 |
|
{ |
265 |
|
string tmp_hostname = Microsoft.VisualBasic.Interaction.InputBox("Indtast servernavn/ip", "MQ Gui", hostname); |
266 |
|
if (tmp_hostname == null || tmp_hostname.Trim().Length == 0) |
267 |
|
return; |
268 |
|
|
269 |
|
hostname = tmp_hostname.Trim(); |
270 |
|
|
271 |
|
RegistryKey key = Registry.LocalMachine.CreateSubKey("Software\\DAO\\DaoMqGui"); |
272 |
|
key.SetValue("Hostname", hostname, RegistryValueKind.String); |
273 |
|
key.Close(); |
274 |
|
|
275 |
|
initClient(); |
276 |
|
loadTransports(); |
277 |
|
} |
278 |
|
|
279 |
} |
} |
280 |
} |
} |