コード例 #1
0
ファイル: Cities.cs プロジェクト: aurora-lzzp/Aurora-Weather
 public void ChangeRoute(LocateRoute[] locateRoute)
 {
     this.Routes = locateRoute;
 }
コード例 #2
0
        public async static Task<CityInfo> ReverseGeoCode(float lat, float lon, LocateRoute[] routes, List<CityInfo> citys)
        {
            List<CityInfo> final = null;

            foreach (var r in routes)
            {
                switch (r)
                {
                    case LocateRoute.unknown:
                        var near = GetNearsetLocation(citys, new Location(lat, lon));
                        final = near.ToList();
                        break;
                    case LocateRoute.Amap:
                        var acontract = await AmapReGeoAsync(lat, lon);
                        if (acontract != null)
                            final = citys.FindAll(x =>
                            {
                                return x.City == acontract.regeocode.addressComponent.district;
                            });
                        break;
                    case LocateRoute.Omap:
                        var ocontract = await OpenMapReGeoAsync(lat, lon);
                        if (ocontract != null)
                            final = citys.FindAll(x =>
                            {
                                return x.City == ocontract.address.city;
                            });
                        break;
                    case LocateRoute.IP:
                        var id = await ReGeobyIpAsync();
                        if (id != null)
                            final = citys.FindAll(x =>
                            {
                                return x.Id == id.CityId;
                            });
                        break;
                    case LocateRoute.Gmap:

                        break;
                    default:
                        break;
                }
                if (!final.IsNullorEmpty())
                {
                    break;
                }
            }

            if (!final.IsNullorEmpty())
            {
                return final[0];
            }
            else
            {
                throw new Exception("Locate Failed.");
            }
        }
コード例 #3
0
 public LocationViewModel(LocateRoute args)
 {
     this.args = args;
     Route = args.GetDisplayName();
 }
コード例 #4
0
 public LocationViewModel(LocateRoute args)
 {
     this.args = args;
     Route     = args.GetDisplayName();
 }