private void btn_music_desc_Click(object sender, EventArgs e) { IComparer <string> comparer = new MusiqueComparer(); g.Musique_playlist[listW_Danse_List.SelectedIndices[0]].Sort(comparer); Maj_Liste_Musique(); }
private void btn_load_rout_Click(object sender, EventArgs e) { OpenFileDialog FileD = new OpenFileDialog(); FileD.Filter = "Text Files (.rtnPlay)|*.rtnPlay"; FileD.FilterIndex = 1; DialogResult result1 = FileD.ShowDialog(); if (result1 == DialogResult.OK) { // chemin string path = FileD.FileName; string[] text = File.ReadAllLines(path); List <string> selection = new List <string>(); string Last_cmd = text[0]; for (int i = 1; i < text.Length; i++) { if (text[i][0] == '#') { Last_cmd = text[i]; } else { if (Last_cmd == "#Danse") { string[] cmd = text[i].Split(';'); Generate_music_list(Int32.Parse(cmd[2]), Int32.Parse(cmd[3]), cmd[0], Int32.Parse(cmd[1])); List <string> s = g.Musique_playlist.Last(); IComparer <string> comparer = new MusiqueComparer(); switch (cmd[4]) { case "Descroissant": s.Sort(comparer); s.Reverse(); break; case "Croissant": s.Sort(comparer); break; default: break; } } else if (Last_cmd == "#Musique") { if (text[i - 1] == "#Musique") { string[] arr = new string[4]; ListViewItem itm; arr[0] = ""; arr[1] = text[i]; arr[2] = "ND"; arr[3] = "ND"; itm = new ListViewItem(arr); listW_Danse_List.Items.Add(itm); } else { selection.Add(text[i]); } if (text[i + 1][0] == '#') { g.Musique_playlist.Add(selection); selection = new List <string>(); } } } } } }