Пример #1
0
 private void LoadFavorite()
 {
     FavoriteListBox.Items.Clear();
     if (GlobalVariables.FavoriteRingtones.Count == 0)
     {
         string favoriteList;
         if (AppSettings.TryGetSetting(FavoriteListSetting, out favoriteList))
         {
             var split = Regex.Split(favoriteList, ";");
             if (split.Any())
             {
                 foreach (var s in split)
                 {
                     for (int index = 0; index < _allRingtones.Count; index++)
                     {
                         var rt = _allRingtones[index];
                         if (rt.Source == s)
                         {
                             GlobalVariables.FavoriteRingtones.Add(rt);
                             var rtItem = (RingtoneItem)RingtoneListBox.Items[index];
                             rtItem.IsFavorite = true;
                         }
                     }
                 }
             }
         }
     }
     foreach (var ringtone in GlobalVariables.FavoriteRingtones)
     {
         var ringtoneItem = new RingtoneItem(ringtone, isFavorite: true);
         ringtoneItem.PlayPauseButtonClick += RingtoneItemPlayPauseButtonClick;
         ringtoneItem.FavoriteButonClick += RingtoneItemFavoriteButonClick;
         FavoriteListBox.Items.Add(ringtoneItem);
     }
 }
Пример #2
0
 private void LoadAllRingtone()
 {
     _allRingtones = Ultility.GetAllRingtone();
     foreach (var ringtone in _allRingtones)
     {
         var ringtoneItem = new RingtoneItem(ringtone);
         ringtoneItem.PlayPauseButtonClick += RingtoneItemPlayPauseButtonClick;
         ringtoneItem.FavoriteButonClick += RingtoneItemFavoriteButonClick;
         RingtoneListBox.Items.Add(ringtoneItem);
     }
 }