public static void OnAssemblyInitialize(TestContext context) { Path = IOPath.GetFullPath(IOPath.Combine(context.TestDir, string.Format("..\\TestLog_{0:yyyy-MM-dd HH_mm_ss}.csv", DateTime.Now))); File.WriteAllLines(Path, new[] { "date-time,duration,result,feature-title,scenario-title" }); }
//加载录制歌单 public void loadmyrecord(object sender, RoutedEventArgs e) { string folderPath = ConfigurationManager.AppSettings["myrecord"]; folderPath = IOPath.GetFullPath(folderPath); string[] mp3Files = EntityService.GetMusicFiles(folderPath); if (mp3Files != null) { playList.Clear(); mp3Files.ToList().ForEach(x => playList.Add(new Song() { Location = x })); //获取歌词和歌曲数 int i = 0; foreach (Song s in playList) { singer_get(s); s.LstLynic = GetLynicBySong(s); i++; } this.num.Text = i.ToString(); } this.songSheet.Text = "我录制的音乐"; s2 = this.songSheet.Text; this.text01.Text = texts01[3].T1; //设置歌单标签 this.text02.Text = texts01[3].T2; //设置歌单简介 }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.rollingText.Text = "音乐播放器处于暂停状态"; //this.rollingText.label1.ForeColor = System.Drawing.Color.Blue; this.listBox.DataContext = playList; playerhandle = player.GetPlayerHandle(); playerhandle.MediaEnded += playerhandle_MediaEnded; playerhandle.MediaFailed += playerhandle_MediaFailed; playerhandle.MediaOpened += playerhandle_MediaOpened; player.playEvent += player_playEvent; player.playEvent_thread += player_playEvent_thread; this.slider.DataContext = player; //读取配置 string folderPath = ConfigurationManager.AppSettings["folderPath"]; folderPath = IOPath.GetFullPath(folderPath); if (!Directory.Exists(folderPath)) { return; } GetMP3Files(folderPath).ToList().ForEach(x => playList.Add(new Song() { Location = x })); //获取歌词 foreach (Song s in playList) { s.LstLynic = GetLynicBySong(s); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.rollingText.Text = "音乐播放器处于暂停状态"; ////第一次生成XML文件,第二次注释掉 //ListText.listTexts = texts; //string s1 = "s.xml"; //ListText.Export(s1); SearchText.DataContext = this; this.listBox.DataContext = playList; playerhandle = player.GetPlayerHandle(); playerhandle.MediaEnded += playerhandle_MediaEnded; playerhandle.MediaFailed += playerhandle_MediaFailed; playerhandle.MediaOpened += playerhandle_MediaOpened; player.playEvent += player_playEvent; player.playEvent_thread += player_playEvent_thread; this.slider.DataContext = player; //读取配置 string folderPath = ConfigurationManager.AppSettings["folderPath"]; folderPath = IOPath.GetFullPath(folderPath); if (!Directory.Exists(folderPath)) { return; } EntityService.GetMusicFiles(folderPath).ToList().ForEach(x => playList.Add(new Song() { Location = x })); //获取歌词和歌曲数 int i = 0; foreach (Song s in playList) { singer_get(s); s.LstLynic = GetLynicBySong(s); i++; } this.songSheet.Text = "默认歌单"; s2 = this.songSheet.Text; this.num.Text = i.ToString(); //设置歌曲数 this.text01.Text = texts01[0].T1; //设置歌单标签 this.text02.Text = texts01[0].T2; //设置歌单简介 }
//加载我的下载歌单 public void loadMydownload(object sender, RoutedEventArgs e) { string folderPath = ConfigurationManager.AppSettings["Mydownload"]; folderPath = IOPath.GetFullPath(folderPath); string[] mp3Files = EntityService.GetMusicFiles(folderPath); if (mp3Files != null) { playList.Clear(); if (File.Exists("Songs.xml")) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(List <Song>)); using (FileStream fs = new FileStream("Songs.xml", FileMode.Open)) { List <Song> songs = (List <Song>)xmlSerializer.Deserialize(fs); songs.ForEach(x => playList.Add(new Song() { Location = x.Location, Album = x.Album, Singer = x.Singer, Name = x.Name })); } } //mp3Files.ToList().ForEach(x => playList.Add(new Song() { Location = x })); //获取歌词和歌曲数 int i = 0; foreach (Song s in playList) { //singer_get(s); s.LstLynic = GetLynicBySong(s); i++; } this.num.Text = i.ToString(); } this.songSheet.Text = "我的下载"; s2 = this.songSheet.Text; this.text01.Text = texts01[1].T1; //设置歌单标签 this.text02.Text = texts01[1].T2; //设置歌单简介 }