public override void parse(XDocument doc)
   {
       try {
       MarketApp retour = new MarketApp();
       String atom = "{http://www.w3.org/2005/Atom}";
       String defaultXlmns = "{http://schemas.zune.net/catalog/apps/2008/02}";
       retour = new MarketApp()
       {
           Id = doc.Element(atom + "feed").Element(atom + "id").Value,
           Title = doc.Element(atom + "feed").Element(atom + "title").Value,
           Description = doc.Element(atom + "feed").Element(atom + "content").Value,
           Image = doc.Element(atom + "feed").Element(defaultXlmns + "image").Element(defaultXlmns + "id").Value,
           DownloadLink = doc.Element(atom + "feed").Element(atom + "entry").Element(defaultXlmns + "url").Value,
           AverageUserRating = Convert.ToDouble(doc.Element(atom + "feed").Element(defaultXlmns + "averageUserRating").Value.Replace('.',',')),      
           UserRatingCount = Convert.ToInt16(doc.Element(atom + "feed").Element(defaultXlmns + "userRatingCount").Value)            
       };
       retour.Id = retour.Id.Replace("urn:uuid:", String.Empty);
       retour.Image = retour.Image.Replace("urn:uuid:", String.Empty);
       retour.Image = "http://cdn.marketplaceimages.windowsphone.com/v3.2/en-US/image/" + retour.Image;
       OnComplete(retour);
       }
       catch (NullReferenceException ne)
       {
           if (doc == null)
               ErrorService.Instance.AddError(this, "xdoc is empty", ErrorType.EMPTY_RESPONSE_FROM_SERVER, ne);
       
       }
 }
示例#2
0
        /*
        private void LoadRandomApp(object sender, DownloadStringCompletedEventArgs e)
        {
            String atom = "{http://www.w3.org/2005/Atom}";
            String defaultXmlns = "{http://schemas.zune.net/catalog/apps/2008/02}";
            XDocument doc = XDocument.Parse(e.Result);
           RandomApp = LoadEntityFromXml(doc);
           OnPropertyChanged("RandomApp");
                          }

        private void LoadRandomGame(object sender, DownloadStringCompletedEventArgs e)
        {
            String atom = "{http://www.w3.org/2005/Atom}";
            String defaultXmlns = "{http://schemas.zune.net/catalog/apps/2008/02}";
            XDocument doc = XDocument.Parse(e.Result);
            RandomGame = LoadEntityFromXml(doc);
            OnPropertyChanged("RandomGame");
        }
        */
        private void LoadDefaultRandomApp(object sender, DownloadStringCompletedEventArgs e)
        {
            String atom = "{http://www.w3.org/2005/Atom}";
            String defaultXmlns = "{http://schemas.zune.net/catalog/apps/2008/02}";
            XDocument doc = XDocument.Parse(e.Result);
            defaultRandomApp=LoadEntityFromXml(doc);
            OnPropertyChanged("DefaultRandomApp");
        }
示例#3
0
 private MarketApp LoadEntityFromXml(XDocument doc)
 {
     MarketApp retour = new MarketApp(); 
     String atom = "{http://www.w3.org/2005/Atom}";
     String defaultXlmns = "{http://schemas.zune.net/catalog/apps/2008/02}";
     retour = new MarketApp()
     {
         Id = doc.Element(atom + "entry").Element(atom + "id").Value,
         Title = doc.Element(atom + "entry").Element(atom + "title").Value,
         SortTitle = doc.Element(atom + "entry").Element(defaultXlmns + "sortTitle").Value,
         Image = doc.Element(atom + "entry").Element(defaultXlmns + "image").Element(defaultXlmns + "id").Value
     };
     retour.Id = retour.Id.Replace("urn:uuid:", String.Empty);
     retour.Image = retour.Image.Replace("urn:uuid:", String.Empty);
     retour.Image = URIModel.Instance.getImageUriString() + retour.Image;
     return retour;
 }
 public override void parse(XDocument doc)
   {
       try {
           parsedApp = new MarketApp();
           String atom = "{http://www.w3.org/2005/Atom}";
           String defaultXlmns = "{http://schemas.zune.net/catalog/apps/2008/02}";
           parsedApp = new MarketApp()
           {
               Id = doc.Element(atom + "entry").Element(atom + "id").Value.Replace("urn:uuid:", String.Empty),
               Title = doc.Element(atom + "entry").Element(atom + "title").Value,
               Description = doc.Element(atom + "entry").Element(atom + "content") != null ? doc.Element(atom + "entry").Element(atom + "content").Value : "",
               SortTitle = doc.Element(atom + "entry").Element(defaultXlmns + "sortTitle").Value,
               Image = doc.Element(atom + "entry").Element(defaultXlmns + "image").Element(defaultXlmns + "id").Value.Replace("urn:uuid:", String.Empty)
           };
           parsedApp.Image = "http://cdn.marketplaceimages.windowsphone.com/v3.2/en-US/image/" + parsedApp.Image;
           OnComplete(parsedApp);
       }catch(NullReferenceException ne){
           OnError(ne);
           if (doc == null)
               ErrorService.Instance.AddError(this, "", ErrorType.NETWORKING_PROBLEM, ne);                  
       }
 }
示例#5
0
 void LoadAppFromObj()
 {
     if (tmpObject != null)
     {
         try
         {
             marketApp = (MarketApp)tmpObject;
             Title.Text = marketApp.Title;
             Description.Text = marketApp.Description;
             Image.Source = new BitmapImage(new Uri(marketApp.Image));
             RatingControl.Value = marketApp.AverageUserRating / 2;
             RatingControl.RatingItemCount = 5;
             this.Tap += AppsPreview_Tap;
             
         }
         catch (InvalidCastException e)
         {
             Debugger.Log(3, "AppsPreview", "expected a MarketApp, get " + tmpObject);
         }
         finally
         {
             tmpObject = null;
         }
     }
 }
示例#6
0
 void AppsPreview_PreviewCompleted(object sender, object obj)
 {
     marketApp = (MarketApp)obj;
     Uri uriToLoad = new Uri(uri.AbsoluteUri + marketApp.Id);
     loader.load(uriToLoad);
     
 }