Example #1
0
        public void AddAllMallsInMap()
        {
            SelectedMallItem       = null;
            SelectedItemVisibility = Visibility.Collapsed;

            var elements = new ObservableCollection <MapElement>();

            foreach (var item in MallList)
            {
                MapIcon mapIcon    = new MapIcon();
                var     bdPosition = new Geopoint(new BasicGeoposition()
                {
                    Latitude  = Double.Parse(item.lat),
                    Longitude = Double.Parse(item.lon)
                });
                if (MallList.IndexOf(item) == 0)
                {
                    MapCenter = bdPosition;
                }
                mapIcon.Location = bdPosition;//LocationManager.TransformFromWorldlToMars(bdPosition);
                mapIcon.Title    = item.name;
                mapIcon.Image    = UnTappedIcon;
                elements.Add(mapIcon);
            }
            MapElements  = elements;
            MapZoomLevel = 12;
        }
Example #2
0
        //private void GetSupportMallListAction()
        //{
        //    string url = string.Format(@"http://op.juhe.cn/atlasyun/mall/list?key={0}&cityid={1}", Configmanager.INDOORMAP_APPKEY, AppSettings.Intance.SelectedCityId);
        //    FormAction action = new FormAction(url);
        //    action.isShowWaitingPanel = true;
        //    action.viewModel = this;
        //    action.Run();
        //    action.FormActionCompleted += (result, ee) =>
        //    {
        //        JsonMallModel jsonMall = JsonConvert.DeserializeObject<JsonMallModel>(result);
        //        if (jsonMall.reason == "成功" || jsonMall.reason == "successed")
        //        {
        //            HttpClientReturnMallList(jsonMall.result);
        //        }
        //    };
        //}
        //public void HttpClientReturnMallList(List<MallModel> jsonMall)
        //{
        //    this.MallList = jsonMall;
        //}

        private void SuscribeCommand()
        {
            //MallList Item Tapped
            MVVMSidekick.EventRouting.EventRouter.Instance.GetEventChannel <object>()
            .Where(x => x.EventName == "CitySelectedChangedEvent")
            .Subscribe(
                e =>
            {
                //未分组数据
                var mallList  = e.EventData as List <MallModel>;
                this.MallList = mallList;

                //分组
                MallGroupList.Clear();
                List <MallGroup> tempMallGroupList = new List <MallGroup>();
                var groups = MallList.GroupBy(n => n.district);
                foreach (IGrouping <string, MallModel> group in groups)
                {
                    tempMallGroupList.Add(new MallGroup()
                    {
                        District = group.Key,
                        MallList = group.Select(x => x).ToList()
                    });
                }
                MallGroupList = tempMallGroupList;
            }
                ).DisposeWith(this);

            //When Search One Mall, Mark It And go for it;
            MVVMSidekick.EventRouting.EventRouter.Instance.GetEventChannel <object>()
            .Where(x => x.EventName == "MarkListSearchedMall")
            .Subscribe(
                e =>
            {
                GoToListViewIndex(e.EventData as MallModel);
            }
                ).DisposeWith(this);

            //MVVMSidekick.EventRouting.EventRouter.Instance.GetEventChannel<object>()
            //    .Where(x => x.EventName == "ListButtonClickByEventRouter")
            //    .Subscribe(
            //    e =>
            //    {
            //        var item = e.EventData as MallModel;
            //        if (item != null)
            //        {

            //         }
            //    }
            //    ).DisposeWith(this);
        }