예제 #1
0
        static void Main(string[] args)
        {
            //CalculatorClient client = new CalculatorClient();
            LocationServiceClient client = new LocationServiceClient();

            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";

            //client.UpdateGeoCoordinate(new zizhujy.services.location.Device() { DeviceName = "Test" },
            //    new zizhujy.services.location.GeoCoordinate() { Remark = "Test" });
            Dictionary <IdentifiedDevice, GeoCoordinate> dic = client.GetLatestGeoCoordinates();

            client.Close();

            /*
             * double value1 = 100.00D;
             * double value2 = 15.99D;
             * double result = client.Add(value1, value2);
             * Console.WriteLine("Add({0}, {1}) = {2}", value1, value2, result);
             * client.Close();
             */

            Console.WriteLine(dic != null ? dic.Count.ToString() : "null");

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
        public Dictionary <IdentifiedDevice, GeoCoordinate> GetLatestGeoCoordinates(string userName, string password)
        {
            Dictionary <IdentifiedDevice, GeoCoordinate> dic = null;

            try
            {
                ZiZhuJYLocationService.LocationServiceClient client = new LocationServiceClient();
                client.ClientCredentials.UserName.UserName = userName;
                client.ClientCredentials.UserName.Password = password;

                dic = client.GetLatestGeoCoordinates();
                client.Close();
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.GetDebugString());
            }

            return(dic);
        }