예제 #1
0
파일: RemoteContext.cs 프로젝트: kekse/Look
 public bool Connect(SharingEndpoint endpoint) {
     return this.ConnectAsync(endpoint).Result;
 }
예제 #2
0
파일: RemoteContext.cs 프로젝트: kekse/Look
        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);
        }
예제 #3
0
파일: RemoteContext.cs 프로젝트: kekse/Look
        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;
        }