//Future //one : load to Master //two : get Master ID //trhee : set Servant's Master ID private void Login_Load(object sender, EventArgs e) { skinListBox1.Items.Clear(); foreach (string configFile in Directory.EnumerateFiles(".\\config", "*.json")) { string botName = Path.GetFileNameWithoutExtension(configFile); switch (botName) { case "ASF": case "example": case "minimal": continue; } CCWin.SkinControl.SkinListBoxItem item = new CCWin.SkinControl.SkinListBoxItem(configFile); skinListBox1.Items.Add(item); if (configFile.Contains("[Master]")) { MasterId = GetMasterId(configFile); } } if (MasterId == "0") { MessageBox.Show("请先添加一个主号!"); } }
private void MoodButtons_Click(object sender, EventArgs e) { where = "分类"; Button topic = (Button)sender; this.panel2.Visible = false; this.panel3.Visible = true; this.label4.Text = topic.Text; string picpath = "C:\\Users\\tianyang\\Pictures\\Saved Pictures\\" + topic.Text + ".jpg"; this.pictureBox1.Load(picpath); this.listBox1.Items.Clear(); listSongid.Clear(); //显示歌曲列表 SongAdapter = new MySqlDataAdapter("select * from song where songtype = \'" + topic.Text + "\'", conn);//应为mood,改了数据库再说 dsong = new DataSet(); SongAdapter.Fill(dsong, "song"); string songitem; DataRow dr1; foreach (DataRow dr in dsong.Tables["song"].Rows) { SingerAdapter = new MySqlDataAdapter("select * from singer where singerid= " + dr.Field <int>("singerid"), conn); dsinger = new DataSet(); SingerAdapter.Fill(dsinger, "singer"); dr1 = dsinger.Tables["singer"].Rows[0]; songitem = dr.Field <string>("songname") + " " + dr1.Field <string>("singername"); CCWin.SkinControl.SkinListBoxItem songsitem = new CCWin.SkinControl.SkinListBoxItem(songitem); listBox1.Items.Add(songsitem); listSongid.Add(dr.Field <int>("songid") + ""); } }
private void btnSearch_Click(object sender, EventArgs e) { var list = icookieInfoService.LoadEntities(c => c.Name.Contains(txtSearch.Text)).ToList(); lbSearchResult.Items.Clear(); foreach (var l in list) { var item = new CCWin.SkinControl.SkinListBoxItem(l.Func, l.pic == null ? Properties.Resources.nopic : CommonHelper.BytesToPic(l.pic)); item.Tag = l; lbSearchResult.Items.Add(item); } }
////////////////////////////////////////////////搜索歌名//////////////////////////////////////// ////////////////////////////////////////////////////////////搜索歌手////////////////////////////////////// private void listBox3_SelectedIndexChanged(object sender, EventArgs e) { //清空上一次搜索出歌曲的列表listBox1和listSongid listBox1.Items.Clear(); listSongid.Clear(); int index = listBox3.SelectedIndex; //显示搜索歌曲的panel panel3.Visible = true; panel3.BringToFront(); //显示歌手图片 SingerAdapter = new MySqlDataAdapter("select * from singer where singername= \'" + listBox3.Items[index] + "\'", conn); dsinger = new DataSet(); SingerAdapter.Fill(dsinger, "singer"); DataRow dr1 = dsinger.Tables["singer"].Rows[0]; pictureBox1.ImageLocation = @dr1.Field <string>("photopath"); //显示歌手名字 label4.Text = dr1.Field <string>("singername"); //显示歌曲列表 string singerid = dr1.Field <int>("singerid") + ""; SongAdapter = new MySqlDataAdapter("select * from song where singerid =" + singerid, conn); dsong = new DataSet(); SongAdapter.Fill(dsong, "song"); string songitem; foreach (DataRow dr in dsong.Tables["song"].Rows) { songitem = dr.Field <string>("songname") + " " + listBox3.Items[index]; CCWin.SkinControl.SkinListBoxItem songsitem = new CCWin.SkinControl.SkinListBoxItem(songitem); listBox1.Items.Add(songsitem); listSongid.Add(dr.Field <int>("songid") + ""); } }