Esempio n. 1
0
        public void SetItem(string imgPath, string title, string servPath, KoreaLocation location)
        {
            if (String.IsNullOrEmpty(imgPath) == false)
            {
                BitmapImage img = new BitmapImage();



                img.UriSource = new Uri(imgPath);

                img_Main.Source = img;
            }

            txt_Title.Text = title;


            if (String.IsNullOrEmpty(servPath) == false)
            {
                BitmapImage img2 = new BitmapImage();

                img2.DecodePixelWidth = 100;

                img2.UriSource = new Uri(servPath);

                img_Serv.Source = img2;
            }


            this.Tag = location;
        }
        private void Item_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            if (sender is ScreenItem)
            {
                ScreenItem item = sender as ScreenItem;


                if (item.Tag != null)
                {
                    KoreaLocation itemData = item.Tag as KoreaLocation;

                    if (String.IsNullOrEmpty(itemData.MapX) == false && String.IsNullOrEmpty(itemData.MapY) == false)
                    {
                        double lng  = Convert.ToDouble(itemData.MapX);;
                        double lat  = Convert.ToDouble(itemData.MapY);
                        string path = "ms-appx:///Assets/";
                        //"ms-appx:///Assets/customicon.png"
                        switch (itemData.Cat1)
                        {
                        case "A01":
                            path += "img1.png";
                            break;

                        case "A02":
                            path += "img2.png";
                            break;

                        case "A03":
                            path += "img3.png";
                            break;

                        case "A04":
                            path += "img4.png";
                            break;

                        case "A05":
                            path += "img5.png";
                            break;

                        case "B01":
                            path += "img6.png";
                            break;

                        case "B02":
                            path += "img7.png";
                            break;
                        }

                        umc_MapControl.SetLocation(lat, lng, itemData.Title, path);
                    }
                }
            }
        }
Esempio n. 3
0
        private async void Item_PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            if (sender is UserPOI)
            {
                UserPOI item = sender as UserPOI;

                _address = item.Tag as KoreaLocation;
                if (String.IsNullOrEmpty((item.Tag as KoreaLocation).FirstImage) == false)
                {
                    BitmapImage img = new BitmapImage();

                    ImageBrush imgBr = new ImageBrush();

                    img.UriSource     = new Uri((item.Tag as KoreaLocation).FirstImage);
                    imgBr.ImageSource = img;
                    imgBr.Stretch     = Stretch.UniformToFill;
                    img_IMage.Fill    = imgBr;

                    img_IMage.Visibility = Visibility.Visible;
                }
                else
                {
                    img_IMage.Fill       = null;
                    img_IMage.Visibility = Visibility.Collapsed;
                }
                txt_Title.Text = (item.Tag as KoreaLocation).Title;

                dr_Info.SetData((item.Tag as KoreaLocation).ContentID, (item.Tag as KoreaLocation).ContentTypeID);
                String data = await Request_Json((item.Tag as KoreaLocation).ContentID, (item.Tag as KoreaLocation).ContentTypeID);

                ParseAreaJson(data);
                String data2 = await Request_Images_Json((item.Tag as KoreaLocation).ContentID, (item.Tag as KoreaLocation).ContentTypeID);

                ParseImagesJson(data2);
                // SetLocation(Convert.ToDouble((item.Tag as KoreaLocation).MapY), Convert.ToDouble((item.Tag as KoreaLocation).MapX));
                if ((item.Tag as KoreaLocation).ContentTypeID == "39" || (item.Tag as KoreaLocation).ContentTypeID == "82")
                {
                    String data3 = await Request_FoodImages_Json((item.Tag as KoreaLocation).ContentID, (item.Tag as KoreaLocation).ContentTypeID);

                    ParseFoodImagesJson(data3);
                }
                else
                {
                    cd_Width.Width = new GridLength(0);
                    st_Serv.Children.Clear();
                }
                st_Festival.Children.Clear();
                List <KoreaLocation> itemObject =
                    MainPage._festivalList.Where(a => a.ContentID == (item.Tag as KoreaLocation).ContentID && a.ContentTypeID == (item.Tag as KoreaLocation).ContentTypeID).ToList();
                if (itemObject != null && itemObject.Count() > 0)
                {
                    tbtn_Festival.Visibility = Visibility.Visible;
                    foreach (KoreaLocation itemin in itemObject)
                    {
                        FestivalControl festy = new FestivalControl();
                        festy.SetItem(itemin.FirstImage, itemin.EventStartDate
                                      , itemin.EventEndDate, itemin.Title);
                        st_Festival.Children.Add(festy);
                    }
                }
                else
                {
                    tbtn_Festival.IsChecked  = false;
                    tbtn_Festival.Visibility = Visibility.Collapsed;
                }
                if (bd_InfoControl.Visibility == Visibility.Collapsed)
                {
                    bd_InfoControl.Visibility = Visibility.Visible;
                }
            }
        }
Esempio n. 4
0
        public void AddPointItem(double latitude, double longitude, String imgPath, String title, string servPath, KoreaLocation location)
        {
            if (latitude > 100)
            {
                return;
            }
            BasicGeoposition snPosition = new BasicGeoposition()
            {
                Latitude = latitude, Longitude = longitude
            };
            Geopoint snPoint = new Geopoint(snPosition);


            UserPOI item = new UserPOI();

            item.SetItem(imgPath, title, servPath, location);

            // Create a XAML border.
            item.PointerReleased += Item_PointerReleased;

            // Center the map over the POI.
            //mc_MapControl.Center = snPoint;
            //mc_MapControl.ZoomLevel = 12;

            // Add XAML to the map.

            mc_MapControl.Children.Add(item);
            MapControl.SetLocation(item, snPoint);
            // MapControl.SetNormalizedAnchorPoint(item, new Point(0.5, 0.5));
        }
Esempio n. 5
0
 public void SetPOI(double latitude, double longitude, String title, String imgPath, String mainPath, KoreaLocation location)
 {
     AddPointItem(latitude, longitude, mainPath, title, imgPath, location);
 }
        private bool SettingItem(bool set, List <KoreaLocation> koreaList, JObject itemObj)
        {
            KoreaLocation korea = new KoreaLocation();

            korea.Addr1         = itemObj["addr1"] == null ? "" : itemObj["addr1"].ToString();
            korea.Addr2         = itemObj["addr2"] == null ? "" : itemObj["addr2"].ToString();
            korea.AreaCode      = itemObj["areacode"] == null ? "" : itemObj["areacode"].ToString();
            korea.Cat1          = itemObj["cat1"] == null ? "" : itemObj["cat1"].ToString();
            korea.Cat2          = itemObj["cat2"] == null ? "" : itemObj["cat2"].ToString();
            korea.Cat3          = itemObj["cat3"] == null ? "" : itemObj["cat3"].ToString();
            korea.ContentID     = itemObj["contentid"] == null ? "" : itemObj["contentid"].ToString();
            korea.ContentTypeID = itemObj["contenttypeid"] == null ? "" : itemObj["contenttypeid"].ToString();
            korea.CreatedTime   = itemObj["createdtime"] == null ? "" : itemObj["createdtime"].ToString();
            korea.FirstImage    = itemObj["firstimage"] == null ? "" : itemObj["firstimage"].ToString();
            korea.Image2        = itemObj["firstimage2"] == null ? "" : itemObj["firstimage2"].ToString();
            korea.MapX          = itemObj["mapx"] == null ? "" : itemObj["mapx"].ToString();
            korea.MapY          = itemObj["mapy"] == null ? "" : itemObj["mapy"].ToString();
            korea.mLevel        = itemObj["mlevel"] == null ? "" : itemObj["mlevel"].ToString();
            korea.ModifiedTime  = itemObj["modifiedtime"] == null ? "" : itemObj["modifiedtime"].ToString();
            korea.ReadCount     = itemObj["readcount"] == null ? "" : itemObj["readcount"].ToString();
            korea.SigunguCode   = itemObj["sigungucode"] == null ? "" : itemObj["sigungucode"].ToString();
            korea.Tel           = itemObj["tel"] == null ? "" : itemObj["tel"].ToString();
            korea.Title         = itemObj["title"] == null ? "" : itemObj["title"].ToString();
            korea.Dist          = itemObj["dist"] == null ? "" : itemObj["dist"].ToString();
            koreaList.Add(korea);

            if (cb_ServiceSelect.SelectedIndex > -1 && korea.Cat1 == cb_ServiceSelect.SelectedValue.ToString())
            {
                if (String.IsNullOrEmpty(korea.MapX) == false && String.IsNullOrEmpty(korea.MapY) == false)
                {
                    double lng  = Convert.ToDouble(korea.MapX);;
                    double lat  = Convert.ToDouble(korea.MapY);
                    string path = "ms-appx:///Assets/";
                    //"ms-appx:///Assets/customicon.png"
                    switch (korea.Cat1)
                    {
                    case "A01":
                        path += "img1.png";
                        break;

                    case "A02":
                        path += "img2.png";
                        break;

                    case "A03":
                        path += "img3.png";
                        break;

                    case "A04":
                        path += "img4.png";
                        break;

                    case "A05":
                        path += "img5.png";
                        break;

                    case "B01":
                        path += "img6.png";
                        break;

                    case "B02":
                        path += "img7.png";
                        break;
                    }

                    umc_MapControl.SetPOI(lat, lng, korea.Title, path, korea.FirstImage, korea);
                    if (!set)
                    {
                        umc_MapControl.SetLocation(lat, lng);
                        set = true;
                    }
                }
            }
            else if (cb_ServiceSelect.SelectedIndex == -1 || cb_ServiceSelect.SelectedIndex == 0)
            {
                if (String.IsNullOrEmpty(korea.MapX) == false && String.IsNullOrEmpty(korea.MapY) == false)
                {
                    double lng  = Convert.ToDouble(korea.MapX);;
                    double lat  = Convert.ToDouble(korea.MapY);
                    string path = "ms-appx:///Assets/";
                    //"ms-appx:///Assets/customicon.png"
                    switch (korea.Cat1)
                    {
                    case "A01":
                        path += "img1.png";
                        break;

                    case "A02":
                        path += "img2.png";
                        break;

                    case "A03":
                        path += "img3.png";
                        break;

                    case "A04":
                        path += "img4.png";
                        break;

                    case "A05":
                        path += "img5.png";
                        break;

                    case "B01":
                        path += "img6.png";
                        break;

                    case "B02":
                        path += "img7.png";
                        break;
                    }

                    umc_MapControl.SetPOI(lat, lng, korea.Title, path, korea.FirstImage, korea);
                    if (!set)
                    {
                        umc_MapControl.SetLocation(lat, lng);
                        set = true;
                    }
                }
            }

            return(set);
        }
        private void ParseFestivalJson(String json)
        {
            //      Task task = new Task(() =>
            //    {

            bool set = false;

            _festivalList = new List <KoreaLocation>();

            JObject obj = JObject.Parse(json);

            if (obj["response"]["header"]["resultMsg"].ToString() == "OK" && Convert.ToDouble(obj["response"]["body"]["totalCount"].ToString()) > 0)
            {
                if (Convert.ToDouble(obj["response"]["body"]["totalCount"].ToString()) == 1)
                {
                    JObject itemObj = (obj["response"]["body"]["items"]["item"]) as JObject;
                    // foreach (JObject itemObj in array)
                    {
                        KoreaLocation korea = new KoreaLocation();
                        korea.Addr1          = itemObj["addr1"] == null ? "" : itemObj["addr1"].ToString();
                        korea.Addr2          = itemObj["addr2"] == null ? "" : itemObj["addr2"].ToString();
                        korea.AreaCode       = itemObj["areacode"] == null ? "" : itemObj["areacode"].ToString();
                        korea.Cat1           = itemObj["cat1"] == null ? "" : itemObj["cat1"].ToString();
                        korea.Cat2           = itemObj["cat2"] == null ? "" : itemObj["cat2"].ToString();
                        korea.Cat3           = itemObj["cat3"] == null ? "" : itemObj["cat3"].ToString();
                        korea.ContentID      = itemObj["contentid"] == null ? "" : itemObj["contentid"].ToString();
                        korea.ContentTypeID  = itemObj["contenttypeid"] == null ? "" : itemObj["contenttypeid"].ToString();
                        korea.CreatedTime    = itemObj["createdtime"] == null ? "" : itemObj["createdtime"].ToString();
                        korea.FirstImage     = itemObj["firstimage"] == null ? "" : itemObj["firstimage"].ToString();
                        korea.Image2         = itemObj["firstimage2"] == null ? "" : itemObj["firstimage2"].ToString();
                        korea.MapX           = itemObj["mapx"] == null ? "" : itemObj["mapx"].ToString();
                        korea.MapY           = itemObj["mapy"] == null ? "" : itemObj["mapy"].ToString();
                        korea.mLevel         = itemObj["mlevel"] == null ? "" : itemObj["mlevel"].ToString();
                        korea.ModifiedTime   = itemObj["modifiedtime"] == null ? "" : itemObj["modifiedtime"].ToString();
                        korea.ReadCount      = itemObj["readcount"] == null ? "" : itemObj["readcount"].ToString();
                        korea.SigunguCode    = itemObj["sigungucode"] == null ? "" : itemObj["sigungucode"].ToString();
                        korea.Tel            = itemObj["tel"] == null ? "" : itemObj["tel"].ToString();
                        korea.Title          = itemObj["title"] == null ? "" : itemObj["title"].ToString();
                        korea.EventStartDate = itemObj["eventstartdate"] == null ? "" : itemObj["eventstartdate"].ToString();
                        korea.EventEndDate   = itemObj["eventenddate"] == null ? "" : itemObj["eventenddate"].ToString();
                        _festivalList.Add(korea);
                    }
                }
                else
                {
                    JArray array = JArray.Parse(obj["response"]["body"]["items"]["item"].ToString());
                    foreach (JObject itemObj in array)
                    {
                        KoreaLocation korea = new KoreaLocation();
                        korea.Addr1          = itemObj["addr1"] == null ? "" : itemObj["addr1"].ToString();
                        korea.Addr2          = itemObj["addr2"] == null ? "" : itemObj["addr2"].ToString();
                        korea.AreaCode       = itemObj["areacode"] == null ? "" : itemObj["areacode"].ToString();
                        korea.Cat1           = itemObj["cat1"] == null ? "" : itemObj["cat1"].ToString();
                        korea.Cat2           = itemObj["cat2"] == null ? "" : itemObj["cat2"].ToString();
                        korea.Cat3           = itemObj["cat3"] == null ? "" : itemObj["cat3"].ToString();
                        korea.ContentID      = itemObj["contentid"] == null ? "" : itemObj["contentid"].ToString();
                        korea.ContentTypeID  = itemObj["contenttypeid"] == null ? "" : itemObj["contenttypeid"].ToString();
                        korea.CreatedTime    = itemObj["createdtime"] == null ? "" : itemObj["createdtime"].ToString();
                        korea.FirstImage     = itemObj["firstimage"] == null ? "" : itemObj["firstimage"].ToString();
                        korea.Image2         = itemObj["firstimage2"] == null ? "" : itemObj["firstimage2"].ToString();
                        korea.MapX           = itemObj["mapx"] == null ? "" : itemObj["mapx"].ToString();
                        korea.MapY           = itemObj["mapy"] == null ? "" : itemObj["mapy"].ToString();
                        korea.mLevel         = itemObj["mlevel"] == null ? "" : itemObj["mlevel"].ToString();
                        korea.ModifiedTime   = itemObj["modifiedtime"] == null ? "" : itemObj["modifiedtime"].ToString();
                        korea.ReadCount      = itemObj["readcount"] == null ? "" : itemObj["readcount"].ToString();
                        korea.SigunguCode    = itemObj["sigungucode"] == null ? "" : itemObj["sigungucode"].ToString();
                        korea.Tel            = itemObj["tel"] == null ? "" : itemObj["tel"].ToString();
                        korea.Title          = itemObj["title"] == null ? "" : itemObj["title"].ToString();
                        korea.EventStartDate = itemObj["eventstartdate"] == null ? "" : itemObj["eventstartdate"].ToString();
                        korea.EventEndDate   = itemObj["eventenddate"] == null ? "" : itemObj["eventenddate"].ToString();
                        _festivalList.Add(korea);
                    }
                }

                //cb_ServiceSelect.ItemsSource = koreaList;
            }

            //   });

            // task.Start();
        }