예제 #1
0
 private void readFromAssets()
 {
     
    //     string DATA = "";
  //       loadStringAsync(DATA);
  //       XDocument doc = XDocument.Load(PATH);
    //     DATA.Start();
   //      DATA.Wait();
         if (IsolatedStorageSettings.ApplicationSettings.Contains("data.xml")) 
         { 
         XDocument doc = XDocument.Parse(IsolatedStorageSettings.ApplicationSettings["data.xml"].ToString());
         foreach (XElement place in doc.Root.Elements())
         {
             KLPlace p = new KLPlace();
             foreach (XElement e in place.Elements())
             {
                 if (e.Name == "title") p.setName(e.Value); else
                 if (e.Name == "image") p.setImageName(e.Value); else
                 if (e.Name == "description") p.setDescription(e.Value); else
                 if (e.Name == "str_location") p.setStreet(e.Value); else
                 if (e.Name == "price") p.setPrice(e.Value); else
                 if (e.Name == "tag") p.addTag(tagBase.getTagByID(e.Value)); else
                 if (e.Name == "subway") p.setSubway(subBase.getSubwayByID(e.Value)); else
                 if (e.Name == "web") p.setWeb(e.Value); else
                 if (e.Name == "location") p.setCoordinates(e.Value); else
                 if (e.Name == "promoted") p.setPromoted(e.Value);
             }
             places.Add(p);
         }
         sortPlaces();
         }
    //     PhoneApplicationService.Current.State["data"] = places;
 }
예제 #2
0
 public PlaceInfoPage()
 {
     InitializeComponent();
     int id = (int)PhoneApplicationService.Current.State["currentPlaceIndex"];
     current = App.ViewModel.data.getPlaces()[id]; 
     this.GetCoordinates();
     
 }