private void RingtoneChooser_Loaded(object sender, RoutedEventArgs e)
        {
            RingtoneListItem item = new RingtoneListItem("none");

            RingtoneList.Items.Add(item);
            if (this.SelectedRingtone != null && this.SelectedRingtone.ToLower().Equals("none"))
            {
                this.RingtoneList.SelectedItem = item;
            }
#if ARM
            string[] sourceDirs = new string[] { "C:\\Data\\Users\\Public\\Ringtones", "C:\\Programs\\CommonFiles\\Sounds" };
#else
            string[] sourceDirs = new string[] { "C:\\Programs\\CommonFiles\\Sounds" };
#endif
            foreach (var dir in sourceDirs)
            {
#if ARM
                string[] files = Directory.GetFiles(dir, "*.*");
#else
                string[] files = EmulatorData.SoundFiles.Select(f => Path.Combine(dir, f)).ToArray();
#endif
                foreach (var str in files)
                {
                    item = new RingtoneListItem(str);
                    RingtoneList.Items.Add(item);
                    if (this.SelectedRingtone != null && str.Equals(this.SelectedRingtone, StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.RingtoneList.SelectedItem = item;
                    }
                }
            }
        }
Exemplo n.º 2
0
 void RingtoneChooser_Loaded(object sender, RoutedEventArgs e)
 {
     var noneItem = new RingtoneListItem(){
         Path = "*none*",
         DisplayName = " -- None --"
     };
     RingtoneList.Items.Add(noneItem);
     if (SelectedRingtone != null && SelectedRingtone.ToLower().Equals("*none*"))
     {
         RingtoneList.SelectedItem = noneItem;
     }
     string[] paths = new string[] { @"C:\Data\Users\Public\Ringtones", @"C:\Programs\CommonFiles\Sounds" };
     foreach (string path in paths)
     {
         string[] files = Directory.GetFiles(path, "*.*");
         if (files != null)
         {
             foreach (var file in files)
             {
                 var item = new RingtoneListItem();
                 item.DisplayName = Path.GetFileNameWithoutExtension(file);
                 item.Path = file;
                 RingtoneList.Items.Add(item);
                 if (SelectedRingtone != null && file.ToLower().Equals(SelectedRingtone.ToLower()))
                 {
                     RingtoneList.SelectedItem = item;
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 private void RingtoneChooser_Loaded(object sender, RoutedEventArgs e)
 {
     RingtoneListItem item = new RingtoneListItem("none");
     RingtoneList.Items.Add(item);
     if (this.SelectedRingtone != null && this.SelectedRingtone.ToLower().Equals("none"))
     {
         this.RingtoneList.SelectedItem = item;
     }
     #if ARM
     string[] sourceDirs = new string[] { "C:\\Data\\Users\\Public\\Ringtones", "C:\\Programs\\CommonFiles\\Sounds" };
     #else
     string[] sourceDirs = new string[] { "C:\\Programs\\CommonFiles\\Sounds" };
     #endif
     foreach (var dir in sourceDirs)
     {
     #if ARM
         string[] files = Directory.GetFiles(dir, "*.*");
     #else
         string[] files = EmulatorData.SoundFiles.Select(f => Path.Combine(dir, f)).ToArray();
     #endif
         foreach (var str in files)
         {
             item = new RingtoneListItem(str);
             RingtoneList.Items.Add(item);
             if (this.SelectedRingtone != null && str.Equals(this.SelectedRingtone, StringComparison.InvariantCultureIgnoreCase))
             {
                 this.RingtoneList.SelectedItem = item;
             }
         }
     }
 }