public bool Connect(SharingEndpoint endpoint) { return this.ConnectAsync(endpoint).Result; }
public async Task<bool> ConnectAsync(string hostOrIp) { var address = new EndpointAddress(string.Format(ViewServiceHost.BASE_ADDRESS, IpHelper.GetIp(hostOrIp), ViewServiceHost.PORT)); var endpoint = new SharingEndpoint("<quickadd>", address); return await this.ConnectAsync(endpoint); }
public async Task<bool> ConnectAsync(SharingEndpoint endpoint) { var ip = IpHelper.GetIp(endpoint.Address.Uri.Host); if (this.connectedHosts.ContainsKey(ip)) return true; var proxy = new ViewServiceClient(endpoint.Address); var result = await Task.Factory.StartNew<bool>(proxy.Connect); if (result) this.connectedHosts.TryAdd(ip, proxy); return result; }