public void Connect(string server)
{
try
{
if (!isConnected)
{
monitorClient = new MonitorClient(new BasicHttpBinding()
{
OpenTimeout = TimeSpan.FromSeconds(5),
SendTimeout = TimeSpan.FromSeconds(10),
ReceiveTimeout = TimeSpan.FromSeconds(10),
CloseTimeout = TimeSpan.FromSeconds(5)
}, new EndpointAddress(string.Format(ConfigurationManager.AppSettings["connectionFormat"], server)));
//monitorClient.Open();
monitorClient.IsStarted();
//monitorClient.ChannelFactory.Open();
isConnected = true;
Update();
timer.Start();
}
}
catch (TimeoutException te)
{
#if DEBUG
view.ShowError(te.ToString());
#else
view.ShowError(te.Message);
#endif
}
catch (EndpointNotFoundException enfe)
{
#if DEBUG
view.ShowError(enfe.ToString());
#else
view.ShowError(enfe.Message);
#endif
}
}