예제 #1
0
        protected override void OnCreate(Bundle icicle)
        {
            base.OnCreate(icicle);
            SetContentView(Resource.Layout.activity_lbssearch);
            CloudManager.Instance.Init(this);
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mBaiduMap = mMapView.Map;
            FindViewById(Resource.Id.regionSearch).Click += delegate
            {
                LocalSearchInfo info = new LocalSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Tags = "";
                info.Q = "�찲��";
                info.Region = "������";
                CloudManager.Instance.LocalSearch(info);

            };
            FindViewById(Resource.Id.regionSearch).Click += delegate
            {
                LocalSearchInfo info = new LocalSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Tags = "";
                info.Q = "�찲��";
                info.Region = "������";
                CloudManager.Instance.LocalSearch(info);
            };
            FindViewById(Resource.Id.nearbySearch).Click += delegate
            {
                NearbySearchInfo info = new NearbySearchInfo();
                info.Ak = "D9ace96891048231e8777291cda45ca0";
                info.GeoTableId = 32038;
                info.Radius = 30000;
                info.Location = "116.403689,39.914957";
                CloudManager.Instance.NearbySearch(info);
            };

            FindViewById(Resource.Id.boundsSearch).Click += delegate
            {
                BoundSearchInfo info = new BoundSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Q = "�찲��";
                info.Bound = "116.401663,39.913961;116.406529,39.917396";
                CloudManager.Instance.BoundSearch(info);
            };
            FindViewById(Resource.Id.detailsSearch).Click += delegate
            {
                DetailSearchInfo info = new DetailSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Uid = 18622266;
                CloudManager.Instance.DetailSearch(info);
            };
        }
        protected override void OnCreate(Bundle icicle)
        {
            base.OnCreate(icicle);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            SetContentView(Resource.Layout.lbssearch);
            CloudManager.Instance.Init(this);

            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mMapView.Controller.EnableClick(true);
            mMapView.Controller.SetZoom(12);
            mMapView.DoubleClickZooming = true;

            FindViewById(Resource.Id.regionSearch).Click += (sender, e) =>
            {
                LocalSearchInfo info = new LocalSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Tags = "";
                info.Q = "天安门";
                info.Region = "北京市";
                CloudManager.Instance.LocalSearch(info);
            };

            FindViewById(Resource.Id.nearbySearch).Click += (sender, e) =>
            {
                NearbySearchInfo info = new NearbySearchInfo();
                info.Ak = "D9ace96891048231e8777291cda45ca0";
                info.GeoTableId = 32038;
                info.Filter = "time:20130801,20130810";
                info.Location = "116.403689,39.914957";
                info.Radius = 30000;
                CloudManager.Instance.NearbySearch(info);
            };

            FindViewById(Resource.Id.boundsSearch).Click += (sender, e) =>
            {
                BoundSearchInfo info = new BoundSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Q = "天安门";
                info.Bound = "116.401663,39.913961;116.406529,39.917396";
                CloudManager.Instance.BoundSearch(info);
            };

            FindViewById(Resource.Id.detailsSearch).Click += (sender, e) =>
            {
                DetailSearchInfo info = new DetailSearchInfo();
                info.Ak = "B266f735e43ab207ec152deff44fec8b";
                info.GeoTableId = 31869;
                info.Uid = 18622266;
                CloudManager.Instance.DetailSearch(info);
            };
        }