Exemple #1
0
        public ActionResult Product(int id)
        {
            ViewServiceClient db      = new ViewServiceClient();
            List <product>    product = db.Get_product(0).ToList();

            return(View(product.Where(m => m.product_cate_id == id)));
        }
        public ActionResult Product(int id)
        {
            ViewServiceClient db = new ViewServiceClient();
            var litem            = db.Get_product(0);

            if (litem == null)
            {
                return(View());
            }

            List <product> product = litem.ToList();

            return(View(product.Where(m => m.product_cate_id == id)));
        }
Exemple #3
0
 public RemoteSharer(string host)
 {
     this.proxy = RemoteContext.Instance.GetProxy(host);
 }
Exemple #4
0
 private void ViewServiceHostConnected(object sender, HostConnectedEventArgs e)
 {
     this.OnHostConnected(e);
     if (e.Accepted)
     {
         var address = new EndpointAddress(string.Format(ViewServiceHost.BASE_ADDRESS, e.Ip, ViewServiceHost.PORT));
         var proxy = new ViewServiceClient(address);
         this.connectedHosts.TryAdd(e.Ip, proxy);
     }
 }
Exemple #5
0
        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;
        }
Exemple #6
0
        public async Task<IEnumerable<RemoteHost>> FindClientsAsync()
        {
            var hosts = new List<RemoteHost>();
            using (var client = new ViewServiceClient())
            {
                foreach (var endpoint in await client.DiscoverAsync())
                {
#if !DEBUG
                    if (!endpoint.Address.Uri.IsLoopback) // enable local testing
#endif
                    hosts.Add(new RemoteHost { Ip = IpHelper.GetIp(endpoint.Address.Uri.Host), Name = endpoint.Name });
                }
            }
            return hosts;
        }
Exemple #7
0
        public IEnumerable<RemoteHost> FindClients()
        {
            using (var client = new ViewServiceClient())
            {
                foreach (var endpoint in client.Discover())
                {
#if !DEBUG
                    if (!endpoint.Address.IsLoopback) // enable local testing
#endif
                    yield return new RemoteHost { Ip = IpHelper.GetIp(endpoint.Address.Uri.Host), Name = endpoint.Name };
                }
            }
        }