public DataItem(Music dat, bool needDeleteBtn = false, MainWindow mw = null) { try { InitializeComponent(); Mainwindow = mw; music = dat; Loaded += delegate { ser.Inlines.Clear(); needb = needDeleteBtn; name.Text = dat.MusicName; foreach (MusicSinger a in dat.Singer) { Ran r = new Ran() { Text = a.Name, data = a }; r.MouseDown += R_MouseDown; ser.Inlines.Add(r); ser.Inlines.Add(new Run(" / ")); } ser.Inlines.Remove(ser.Inlines.LastInline); mss.Text = dat.MusicName_Lyric; }; } catch { } }
private void R_MouseDown(object sender, MouseButtonEventArgs e) { Ran r = sender as Ran; MusicSinger ms = r.data as MusicSinger; GetToSingerPage(ms); }
public DataItem(Music dat, MainWindow mw, bool needDeleteBtn = false) { try { InitializeComponent(); Mainwindow = mw; music = dat; Loaded += delegate { ser.Inlines.Clear(); needb = needDeleteBtn; name.Text = dat.MusicName; if (dat.Album.Name != null) { ab.Text = dat.Album.Name.Replace("空", ""); } foreach (MusicSinger a in dat.Singer) { Ran r = new Ran() { Text = a.Name, data = a }; r.MouseDown += R_MouseDown; ser.Inlines.Add(r); ser.Inlines.Add(new Run(" / ")); } ser.Inlines.Remove(ser.Inlines.LastInline); mss.Text = dat.MusicName_Lyric; int BtnCount = 0; if (dat.Mvmid != "") { MV.Visibility = Visibility.Visible; BtnCount++; } if (dat.Pz == "HQ") { HQ.Visibility = Visibility.Visible; BtnCount++; } else if (dat.Pz == "SQ") { SQ.Visibility = Visibility.Visible; BtnCount++; } BtnWidth = 32 * BtnCount + 5; if (namss.ActualWidth > wpl.ActualWidth - BtnWidth) { namss.Width = wpl.ActualWidth - 101; } }; } catch { } }