/// <summary> /// 获取歌手照片集合 /// </summary> public void GetSingerPhoto() { List <SingerInfo> singerList = singermanage.GetSingerList(singerType); for (int i = 0; i < singerList.Count; i++) { this.imgSinger.Images.Add(Image.FromFile(GetAllURL() + "\\" + singerList[i].SRI_SingePhotoURL1)); this.imgSinger.Tag = i; } }
/// <summary> /// 查询歌手信息 /// </summary> public void SearchSinger() { List <Singer> singerList = singermanage.GetSingerList(this.txtSingerNameSearch.Text.Trim(), this.cmbSingerTypeSearch.Text.Trim()); if (singerList.Count == 0) { MessageBox.Show("没有查到数据", "查询", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.dgvSingerList.DataSource = singerList; }
/// <summary> /// 绑定歌手下拉框 /// </summary> public void GetSingerNameList() { List <Singer> singerList = singermanage.GetSingerList("", ""); List <string> singerNameList = new List <string>(); for (int i = 0; i < singerList.Count; i++) { singerNameList.Add(singerList[i].SRI_SingerName1); } this.cmbSinger.DataSource = singerNameList; this.cmbSingerSearch.DataSource = singerNameList; }
/// <summary> /// 回馈数据 /// </summary> /// <param name="str"></param> private void ReturnJson(string str, Socket returnSocket) { string[] message = str.Split('-');//字符串转换为字符串数组 try { Byte[] returnData = null;//字符串转换为字节数组 SingerManage singer = new SingerManage(); SongManage song = new SongManage(); message[2] = message[2].Replace("\n", ""); switch (message[0]) { case "Song": #region 查找歌曲 List <SongInfo> songList = null; switch (message[1]) { case "1": //查找所有歌手 returnData = null; List <SingerInfo> singerList = singer.GetSingerList(""); returnData = GetJson(singerList); break; case "2": //查找某个歌手的所有歌曲 returnData = null; songList = song.GetSongList("歌手", message[2]); returnData = GetJson(songList); break; case "3": //歌名点歌 returnData = null; songList = song.GetSongList("歌名s", message[2]); returnData = GetJson(songList); break; case "4": //字数点歌 returnData = null; songList = song.GetSongList("字数", message[2]); returnData = GetJson(songList); break; case "5": //金曲点歌 returnData = null; songList = song.GetSongList("排行", message[2]); returnData = GetJson(songList); break; case "6": //类型点歌 returnData = null; songList = song.GetSongList("类型", message[2]); returnData = GetJson(songList); break; } returnSocket.Send(returnData, returnData.Length, SocketFlags.None); //发送回馈 #endregion break; case "Function": #region 功能 switch (message[1]) { case "1": #region 切歌 returnData = null; PlayList.CutSong(); returnData = Encoding.UTF8.GetBytes("true"); returnSocket.Send(returnData, returnData.Length, SocketFlags.None); //发送回馈 break; #endregion case "2": #region 重唱 returnData = null; PlayList.PlayAgain(); returnData = Encoding.UTF8.GetBytes("true"); returnSocket.Send(returnData, returnData.Length, SocketFlags.None); //发送回馈 break; #endregion case "3": #region 务 returnData = null; RoomManage roommanage = new RoomManage(); bool result = roommanage.Server(FrmMain.roomId); if (result) { returnData = Encoding.UTF8.GetBytes("true"); returnSocket.Send(returnData, returnData.Length, SocketFlags.None); //发送回馈 break; } returnData = Encoding.UTF8.GetBytes("false"); returnSocket.Send(returnData, returnData.Length, SocketFlags.None); //发送回馈 break; #endregion case "4": #region 暂停 returnData = null; if (FrmPlaySong.pause == 0) { play.Pause(1); returnData = Encoding.UTF8.GetBytes("Function-4-1"); } else if (FrmPlaySong.pause == 1) { play.Pause(0); returnData = Encoding.UTF8.GetBytes("Function-4-0"); } returnSocket.Send(returnData, returnData.Length, SocketFlags.None); //发送回馈 break; #endregion case "5": #region 原唱 returnData = null; if (FrmPlaySong.truck == 0) { play.wmp.SetConfig(403, "1"); FrmPlaySong.truck = 1; returnData = Encoding.UTF8.GetBytes("Function-5-1"); } else if (FrmPlaySong.truck == 1) { play.wmp.SetConfig(403, "0"); FrmPlaySong.truck = 0; returnData = Encoding.UTF8.GetBytes("Function-5-0"); } returnSocket.Send(returnData, returnData.Length, SocketFlags.None); //发送回馈 break; #endregion } #endregion break; case "AddSong": #region 点歌 List <SongInfo> addSong = song.GetSongList("歌名", message[1]); SongInfo songInfo = new SongInfo(); songInfo = addSong[0]; PlayList.Songgroup.Add(songInfo); song.CountAdd(songInfo.SGI_SongId1); #endregion break; case "conn": #region 连接测试 returnData = null; returnData = Encoding.UTF8.GetBytes("conn"); returnSocket.Send(returnData, returnData.Length, SocketFlags.None); //发送回馈 #endregion break; case "getbtn": #region 获得按钮状态 returnData = null; string paruse = FrmPlaySong.pause.ToString() + "-" + FrmPlaySong.truck.ToString(); returnData = Encoding.UTF8.GetBytes(paruse); returnSocket.Send(returnData, returnData.Length, SocketFlags.None); //发送回馈 #endregion break; } } catch (Exception) { Byte[] returnData = Encoding.UTF8.GetBytes("false"); returnSocket.Send(returnData, returnData.Length, SocketFlags.None);//反馈false } }