Exemplo n.º 1
0
        private void favoritesSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (favoritesList.SelectedIndex != -1)
            {
                Song[] songs =
                    itemCollections.favoritesDict.Values.ToArray();
                if (songs.Length > 0)
                {
                    searchResult = new SearchResult
                                       {
                                           trackList = songs,
                                           tracksTotal = songs.Length
                                       };
                    itemCollections.currentMood = new Tag
                                                      {
                                                          type =
                                                              Constants.
                                                              TYPE_ACTIVITY,
                                                          value =
                                                              "favorites!"
                                                      };
                    if (itemCollections.getSongsForTagDictionary().ContainsKey(itemCollections.currentMood.value))
                    {
                        itemCollections.getSongsForTagDictionary().Remove(itemCollections.currentMood.value);
                    }

                    itemCollections.getSongsForTagDictionary().Add(
                        itemCollections.currentMood.value, songs);

                    itemCollections.currentTrackNumber = favoritesList.SelectedIndex;
                    itemCollections.SaveApplicationState();
                    StorageUtility.writeStringToFile(IsolatedStorageFile.GetUserStoreForApplication(),
                "CurrentTrackNumber.txt", itemCollections.currentTrackNumber.ToString(CultureInfo.InvariantCulture));

                    Uri songDetailsUri = new Uri("/SongDetailsPage.xaml",
                                                 UriKind.Relative);
                    NavigationService.Navigate(songDetailsUri);
                }
            }

        }
Exemplo n.º 2
0
        private void loadFinished(int METHOD, Song[] songs, Dictionary<string, string> returnedParams)
        {
            unblockUI();

            switch (METHOD)
            {
                case Constants.METHOD_RESET:
                    {
                        break;
                    }
                case Constants.METHOD_QUITAPP:
                    {
                        break;
                    }
                case Constants.METHOD_SEARCH:
                    {

                        if (songs != null && songs.Length > 0)
                        {
                            if (returnedParams.ContainsKey("VALUE"))
                            {
                                searchResult = new SearchResult
                                                   {
                                                       trackList = songs,
                                                       tracksTotal = songs.Length
                                                   };
                                itemCollections.currentMood = new Tag
                                                                  {
                                                                      type = returnedParams["TYPE"],
                                                                      value = returnedParams["VALUE"]
                                                                  };
                            }

                            if (itemCollections.currentMood != null &&
                                !itemCollections.getSongsForTagDictionary().ContainsKey(itemCollections.currentMood.value))
                            {
                                itemCollections.getSongsForTagDictionary().Add(itemCollections.currentMood.value, songs);
                            }
                            itemCollections.songs = songs;
                            itemCollections.SaveApplicationState();
                            Uri songDetailsUri =
                                new Uri("/SongDetailsPage.xaml",
                                        UriKind.Relative);
                            NavigationService.Navigate(songDetailsUri);
                        }
                        break;
                    }
            }

        }