示例#1
0
        public IEnumerable <Resource> GetResources()
        {
            var request = new KcfRequest
            {
                MethodName = KnownStrings.GetSnapshot_Method,
                Data       = new ArgMap()
            };
            var response = mClient.CallApi(request);

            var resourceList = new List <Resource>();

            var devicesRaw = response.Data[KnownStrings.Devices] as ArgList;

            if (devicesRaw != null)
            {
                FillResourceList(resourceList, devicesRaw);
            }

            var chassisesRaw = response.Data[KnownStrings.Chassis] as ArgList;

            if (chassisesRaw != null)
            {
                FillResourceList(resourceList, chassisesRaw);
            }

            return(resourceList);
        }
        public KcfResponse CallApi(KcfRequest request)
        {
            KcfResponse response = null;
            var         manager  = CommunicationManager.Instance;

            if (manager != null)
            {
                try
                {
                    var result = manager.CallWait(manager.ServiceNode,
                                                  DiscoveryServiceName,
                                                  request.MethodName,
                                                  request.Data,
                                                  request.Timeout);
                    response = new KcfResponse {
                        Data = result
                    };
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                }
            }
            return(response);
        }