public static void AddCreatorMessage(MHzSongList list, JToken creator_jo) { if (creator_jo == null) { return; } list.Creator = CreateDefaultCreatorInstance(creator_jo); }
private void SetListHeader(MHzSongList song_list) { try { var succeed = Uri.TryCreate(song_list.Cover, UriKind.Absolute, out var img_cover); TitleBackImage.Source = succeed ? new Windows.UI.Xaml.Media.Imaging.BitmapImage(img_cover) : null; SongListImage.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(succeed ? img_cover : new Uri("ms-appx:///Assets/star006.png")); SongListTitle.Text = song_list.Title; SongListCount.Text = song_list.Count.ToString() + GetUIString("MusicCount_Tail"); CollectedCount.Text = song_list.CollectedCount.ToString() + GetUIString("Collect_Tail"); var succeed2 = Uri.TryCreate(song_list.Creator?.Picture, UriKind.Absolute, out var img_cover2); CreatorImage.ImageSource = new Windows.UI.Xaml.Media.Imaging.BitmapImage(succeed2 ? img_cover2 : new Uri("ms-appx:///Assets/star006.png")); CreatorName.Text = song_list.Creator?.Name; } catch { /* Ingore */ } }
private async Task <bool> InsertMHzItemAsync(MHzSongBase song, int index = -1) { var find_index = MHzSongList.ToList().FindIndex(i => i.SHA256 == song.SHA256); if (find_index != -1) { return(true); } var item = await MusicServiceHelper.CreatePlayItemAsync(song); var retuenIndex = InsertMHzItem(item, index); MHzSongList.Insert(retuenIndex, song); RaisePropertyChanged("MHzSongList"); return(retuenIndex == -1 ? false : true); }
private bool RemoveMHzPlaybackItem(MediaPlaybackItem item) { if (IsCurrentMHzItem(item)) { return(false); } var succeed = MHzChannelList.Items.Remove(item); if (!succeed) { return(succeed); } var song = SelectMHzSongItemBySHA256(item.Source.CustomProperties["SHA256"] as string); if (song == null) { return(false); } succeed = MHzSongList.Remove(song); RaisePropertyChanged("MHzSongList"); return(succeed); }
private bool RemoveMHzPlaybackItem(MHzSongBase song) { var item = SelectMHzItemBySHA256(song.SHA256); if (item == null) { return(false); } if (IsCurrentMHzItem(item)) { return(false); } var succeed = MHzChannelList.Items.Remove(item); if (!succeed) { return(succeed); } succeed = MHzSongList.Remove(song); RaisePropertyChanged("MHzSongList"); return(succeed); }
private MHzSongBase SelectMHzSongItemBySHA256(string sha256) { return(MHzSongList.ToList().Find(i => i.SHA256 == sha256)); }
public bool IsExistMHzItem(MHzSongBase song) { var find_index = MHzSongList.ToList().FindIndex(i => i.SHA256 == song.SHA256); return(find_index == -1 ? false : true); }