public void Init() { string projectPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\Samples\bouncing_ball.fs2"); projectPath = Path.GetFullPath(projectPath); Assert.IsTrue(server.Start(projectPath)); EndpointAddress epAddress = new EndpointAddress(server.BaseAddress + "ChannelInformationRetriever"); client = new ChannelInformationRetrieverClient(new WSDualHttpBinding(WSDualHttpSecurityMode.None), epAddress); }
public void GetChannels(string serverAddress) { List <ChannelInfo> channels = new List <ChannelInfo>(); ChannelInformationRetrieverClient client = null; try { WriteStatus("Connecting to server..."); EndpointAddress epAddress = new EndpointAddress(serverAddress); client = new ChannelInformationRetrieverClient(new WSDualHttpBinding(WSDualHttpSecurityMode.None), epAddress); WriteStatus("Getting channel data..."); if (client != null) { long channelCount = client.GetChannelsCount(); SetProgressBarLimits((int)channelCount); for (long i = 0; i < channelCount; i++) { channels.Add(client.GetChannel(i)); SetProgressBarValue((int)i); } } client.Close(); } catch (Exception exception) { string message = string.Format("Error during connection to server: {0}", exception.Message); if (client != null && client.State == CommunicationState.Opened) { client.Close(); } NotifyOperationComplete(false, channels.ToArray(), message); return; } NotifyOperationComplete(true, channels.ToArray(), ""); }